-
Notifications
You must be signed in to change notification settings - Fork 49
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
Check for NV_DX_interop extension available and fallback mode #109
Comments
I think we should fall back (or at least have the option to fall back) to a version that does that CPU roundtrip if interop is not supported. |
Moving this to |
I've had black screen issues with Intel UHD gpus, in those cases software fallback seems to solve the problem, but on some integrated gpus this AccessViolationException completely crashes my application and I've had no success try/catching this. It would be great if it would be possible to at least safely handle cases when this control fails to initialize. |
@Krugpelke how would you like to handle the initialization error? Should we throw a more specific exception or should we have some other way of handling this? |
Personally, I'm completely fine with throwing an exception in how it's currently implemented in 4.3.1, it should work as long as NV_DX_interop is safely handled.
|
With 67129a3 I've added a |
I'm in the process of switching my prototype Windows (WPF) (.NET 8) app from using SharpGL to OpenTK 4, because everywhere I read suggests OpenTK is better. I now get an Access Violation exception when showing the window containing the GLWpfControl, and I believe it is related to this issue, judging from the above comments.
My machine only has Intel built-in graphics hardware, so I suspect I do not have NV_DX_interop support. It looks as though this is a known issue, with the only proposed solution being to throw a PlatformNotSupportedException. The trouble is, many of my users will be in the same position as me. This seems a major handicap to OpenTK, from my perspective, meaning I simply cannot use it. Is there not any better solution? There should at least be a warning (preferably in bold text) which people will see before they try to install or use the control. I've wasted a whole afternoon on this. |
To print a list of all WGL extensions your GPU+driver combo supports you can use this code: [DllImport("opengl32.dll")]
static extern IntPtr wglGetCurrentDC();
public static unsafe void PrintWGLExtensions()
{
Wgl.LoadBindings(new GLFWBindingsContext());
IntPtr dc = wglGetCurrentDC();
string[] extensions = Wgl.Arb.GetExtensionsString(dc).Split(' ');
for (int i = 0; i < extensions.Length; i++)
{
Console.WriteLine(extensions[i]);
}
} You will have to call this function after your control and OpenGL context has been created. If your driver supports |
Thanks. I have the GLview utility and can see that my driver doesn't support NV_DX_interop. Am I right in concluding I cannot use OpenTK at all? |
Unfortunately not at the moment, no. In older versions of this repo there was an implementation that read the data fram OpenGL to the cpu and then uploaded it back to DX, so it shouldn't be too hard to bring parts of that code back. But I'm not sure how soon I can get to that, if someone else decided to have a go at it before me that would be fantastic. |
I have limited experience with OpenGL, and none with DirectX, otherwise I might offer to help. All I wanted was a C# wrapper for OpenGL that was reasonably future-proof. It looks like OpenTK has gone a bit too far into the future, and left the present behind. I don't know how representative my experience is, but if it is common, OpenTK may have shot itself in the foot. |
Looking at the old renderer's source it's quite simple so I don't think it would be too much work to actually do the slower fallback method of rendering. If no one else wants to have a go at implementing this into the control I'll do it. But not sure how fast I can get to it. But basically the change would mean checking for |
Looking at https://opengl.gpuinfo.org/listreports.php?extension=WGL_NV_DX_interop&option=not and filtering for "Windows" and "OpenGL" (exclusing OpenGLES) most of the GPUs that don't support Generally |
I have an Intel(R) UHD Graphics 770 (Forward Context 4.6). It is on a PC that is only 18 months old. The rest of the PC is fairly high spec. I don't need a fancy graphics card, not least because many of my customers don't either, so I need to know how well the program will work for them. |
Looking at reports for the UHD Graphics 770 you should expect Do you know what graphics driver you are running? The oldest driver version reported on the website is Should be as simple as just installing the latest driver to get it working in that case. |
My most recent graphics driver update was this: |
The GLview Extensions Viewer only shows you GL_ extensions and will not show you platform specific extensions for WGL (nor EGL, GLX etc). So this seems to be a recurring issue with Can you show me the code you use to initialize your |
And just to make sure, what version of GLWpfControl are you running? |
4.3.2 |
There will be no fallback mode in |
At this current time, this control only works if the NV_DX_interop is supported. If the extension is not supported, an AccessViolationException is thrown. This happened to me on a virtual machine where 3D acceleration was enabled via a virtual Mesa graphics card.
I've got the following questions:
DXGLContext
? If so, should we expose a dependency property and/or an event when the initialization fails? Doing so, the control could notify the user about the issue, so that the error can be handled correctly by the application.The text was updated successfully, but these errors were encountered: