Fix T102322: Crash on exiting VR session when using DirectX backend
This prevents Blender from crashing with an access violation when stopping a VR session using the DirectX backend. The issue occurred for any headset on Windows+Nvidia when using the SteamVR runtime and thus affected a large number of users. The workaround presented here is to simply skip unregistering the shared resources on exit, as either of the calls to `wglDXUnregisterObjectNV()` or `wglDXCloseDeviceNV()` will result in an access violation. While not ideal, this avoids the crash and doesn't present any issues when starting a new VR session. Reviewed By: Severin Differential Revision: https://developer.blender.org/D16569
This commit is contained in:
parent
41ae2c6438
commit
db28a8b3d1
Notes:
blender-bot
2023-02-13 23:16:02 +01:00
Referenced by issue #102322, Crash on exiting VR session when using DirectX backend Referenced by issue #102182, OpenXR: Virtual Monitor experiment
|
@ -179,13 +179,14 @@ class GHOST_SharedOpenGLResource {
|
|||
}
|
||||
|
||||
if (m_is_initialized) {
|
||||
if (m_shared.render_target
|
||||
#if 1
|
||||
#if 0 /* TODO: Causes an access violation since Blender 3.4 (a296b8f694d1). */
|
||||
if (m_shared.render_target
|
||||
# if 1
|
||||
/* TODO: #wglDXUnregisterObjectNV() causes an access violation on AMD when the shared
|
||||
* resource is a GL texture. Since there is currently no good alternative, just skip
|
||||
* unregistering the shared resource. */
|
||||
&& !m_use_gl_texture2d
|
||||
#endif
|
||||
# endif
|
||||
) {
|
||||
wglDXUnregisterObjectNV(m_shared.device, m_shared.render_target);
|
||||
}
|
||||
|
@ -199,6 +200,12 @@ class GHOST_SharedOpenGLResource {
|
|||
else {
|
||||
glDeleteRenderbuffers(1, &m_gl_render_target);
|
||||
}
|
||||
#else
|
||||
glDeleteFramebuffers(1, &m_shared.fbo);
|
||||
if (m_use_gl_texture2d) {
|
||||
glDeleteTextures(1, &m_gl_render_target);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue