Fix RenderDoc OpenGL capture - pass HGLRC instead of HDC

Critical fix: For OpenGL, RenderDoc requires HGLRC (OpenGL context) as
the device pointer, not HDC. Previously OpenGL test incorrectly passed
HDC which caused capture to silently fail (NumCaptures=0).

Changes:
- OpenGLDevice: Add wglCreateContextAttribsARB support for debug context
- OpenGLDevice: Create OpenGL 4.6 core profile with debug flag
- RenderDocCapture: Pass correct window to SetActiveWindow/StartFrameCapture
- OpenGL test: Pass HGLRC via SetDevice(), use BeginCapture/EndCapture

Fix root cause identified via RenderDoc docs analysis:
  'For OpenGL it must be the HGLRC, GLXContext, or EGLContext'
This commit is contained in:
2026-03-23 18:35:49 +08:00
parent e9f4f2dc49
commit 36683b4bb3
3 changed files with 112 additions and 5 deletions

View File

@@ -122,14 +122,19 @@ void RenderDocCapture::BeginCapture(const char* title) {
if (title) {
m_api->SetCaptureTitle(title);
}
m_api->StartFrameCapture(m_device, nullptr);
SetForegroundWindow((HWND)m_window);
SetFocus((HWND)m_window);
m_api->SetActiveWindow(m_device, m_window);
m_api->StartFrameCapture(m_device, m_window);
}
void RenderDocCapture::EndCapture() {
if (!m_isLoaded || !m_api) {
return;
}
m_api->EndFrameCapture(m_device, nullptr);
m_api->EndFrameCapture(m_device, m_window);
}
void RenderDocCapture::TriggerCapture() {