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
"Failed to create shared context for shader compiling." messages when using OpenGL with Dolphin #2361
Comments
* In the old codepath for a valid existing window we'd create a cloned DC and use that to pop with. However that DC is then released so we have created the 'stale DC' situation. This can cause problems with subsequent context activations when we try to push/pop to populate GL hooks and fail to pop properly as the queried DC is invalid.
This seems to be related to dolphin using an archaic GL 1.0 function I don't understand why this is being done since dolphin unconditionally relies on the (comparatively) modern For whatever reason Removing the call (see below patch) and just passing in the share context directly seems to work fine, though the above referenced commit on the RenderDoc side is also necessary to fix some crashes/further failures due to weird edge-cases in context sharing and pushing/popping internal shared contexts. (OpenGL is a trash API 😢 ). diff --git a/Source/Core/Common/GL/GLInterface/WGL.cpp b/Source/Core/Common/GL/GLInterface/WGL.cpp
index 69d9e93912..d0d343be01 100644
--- a/Source/Core/Common/GL/GLInterface/WGL.cpp
+++ b/Source/Core/Common/GL/GLInterface/WGL.cpp
@@ -396,20 +396,9 @@ HGLRC GLContextWGL::CreateCoreContext(HDC dc, HGLRC share_context)
0};
// Attempt creating this context.
- HGLRC core_context = wglCreateContextAttribsARB(dc, nullptr, attribs.data());
+ HGLRC core_context = wglCreateContextAttribsARB(dc, share_context, attribs.data());
if (core_context)
{
- // If we're creating a shared context, share the resources before the context is used.
- if (share_context)
- {
- if (!wglShareLists(share_context, core_context))
- {
- ERROR_LOG_FMT(VIDEO, "wglShareLists failed");
- wglDeleteContext(core_context);
- return nullptr;
- }
- }
-
INFO_LOG_FMT(VIDEO, "WGL: Created a GL {}.{} core context", version.first, version.second);
return core_context;
} |
When RenderDoc is attached, wglShareLists fails for some reason (see baldurk/renderdoc#2361). wglCreateContextAttribsARB has a parameter for the share context, so there's no reason to use a separate wglShareLists call. Co-authored-by: baldurk <baldurk@baldurk.org>
The fix has been merged into Dolphin (5.0-15150 and newer have it), thanks! I assume the the other fix relates to the black screen on the first launch. I haven't tested nightly RenderDoc builds, but I did notice that with v1.15 and the fix to Dolphin, trying to make a capture on that black screen no longer causes Dolphin to exit and instead a capture is successfully made (though the contents of the capture aren't particularly useful). It's still possible to work around the black screen by closing and then reopening the fifolog/game, so it's not big problem. |
For me it would either crash (on nvidia) or fail to compile shaders (on AMD) due to context juggling leading to the a mismatch between the context RenderDoc thinks is bound and the actual context and I ended up trampling over state and worse. All due to obtuse rules around DCs and contexts on windows, very tedious :(. A black screen certainly would be possible as well as one of the states I was trampling was the VAO's current index buffer bound. Either way, it should work properly on the latest nightly and if it doesn't then please let me know. |
Yes, the latest nightly (v1.16 - 3d785b9) seems to work fine for me. |
When RenderDoc is attached, wglShareLists fails for some reason (see baldurk/renderdoc#2361). wglCreateContextAttribsARB has a parameter for the share context, so there's no reason to use a separate wglShareLists call. Co-authored-by: baldurk <baldurk@baldurk.org>
Description
When trying to capture Dolphin using the OpenGL backend, Dolphin fails to start the first time and shows a large number of panic alerts.
This isn't a blocker for me, as Dolphin's other video backends use essentially the same shaders so I can do debugging with the other backends (and it seems like vertex and pixel debugging aren't even implemented for OpenGL). But I figure it's still worth reporting as a test case should OpenGL be improved.
Steps to reproduce
Debug info (NVIDIA Corporation, NVIDIA GeForce GTX 1650 Ti/PCIe/SSE2, 4.6.0 NVIDIA 471.41):
Debug info (NVIDIA Corporation, NVIDIA GeForce GTX 1650 Ti/PCIe/SSE2, 4.6.0 NVIDIA 471.41):
Debug info (NVIDIA Corporation, NVIDIA GeForce GTX 1650 Ti/PCIe/SSE2, 4.6.0 NVIDIA 471.41):
Environment
The text was updated successfully, but these errors were encountered: