GHOST/XR: support Wayland via XrGraphicsBindingOpenGLWaylandKHR
This commit is contained in:
parent
b129a0b397
commit
3d7021b4ec
Notes:
blender-bot
2023-02-14 11:00:17 +01:00
Referenced by issue #83697, Rotate sculpting brush may have an incorrect pen pressure behavior
|
@ -484,10 +484,15 @@ if(WITH_XR_OPENXR)
|
|||
)
|
||||
elseif(UNIX AND NOT APPLE)
|
||||
list(APPEND XR_PLATFORM_DEFINES -DXR_OS_LINUX)
|
||||
if (WITH_GL_EGL)
|
||||
list(APPEND XR_PLATFORM_DEFINES -DXR_USE_PLATFORM_EGL)
|
||||
else()
|
||||
list(APPEND XR_PLATFORM_DEFINES -DXR_USE_PLATFORM_XLIB)
|
||||
if (WITH_GHOST_WAYLAND)
|
||||
list(APPEND XR_PLATFORM_DEFINES -DXR_USE_PLATFORM_WAYLAND)
|
||||
endif()
|
||||
if (WITH_GHOST_X11)
|
||||
if (WITH_GL_EGL)
|
||||
list(APPEND XR_PLATFORM_DEFINES -DXR_USE_PLATFORM_EGL)
|
||||
else()
|
||||
list(APPEND XR_PLATFORM_DEFINES -DXR_USE_PLATFORM_XLIB)
|
||||
endif()
|
||||
endif()
|
||||
endif()
|
||||
|
||||
|
|
|
@ -39,6 +39,9 @@ class GHOST_IXrGraphicsBinding {
|
|||
#elif defined(WIN32)
|
||||
XrGraphicsBindingOpenGLWin32KHR wgl;
|
||||
XrGraphicsBindingD3D11KHR d3d11;
|
||||
#endif
|
||||
#if defined(WITH_GHOST_WAYLAND)
|
||||
XrGraphicsBindingOpenGLWaylandKHR wl;
|
||||
#endif
|
||||
} oxr_binding;
|
||||
|
||||
|
|
|
@ -420,7 +420,7 @@ void GHOST_XrContext::getExtensionsToEnable(
|
|||
r_ext_names.push_back(gpu_binding);
|
||||
}
|
||||
|
||||
#if defined(WITH_GL_EGL)
|
||||
#if defined(WITH_GHOST_X11) && defined(WITH_GL_EGL)
|
||||
assert(openxr_extension_is_available(m_oxr->extensions, XR_MNDX_EGL_ENABLE_EXTENSION_NAME));
|
||||
r_ext_names.push_back(XR_MNDX_EGL_ENABLE_EXTENSION_NAME);
|
||||
#endif
|
||||
|
|
|
@ -24,6 +24,12 @@
|
|||
|
||||
#if defined(WITH_GL_EGL)
|
||||
# include "GHOST_ContextEGL.h"
|
||||
# if defined(WITH_GHOST_X11)
|
||||
# include "GHOST_SystemX11.h"
|
||||
# endif
|
||||
# if defined(WITH_GHOST_WAYLAND)
|
||||
# include "GHOST_SystemWayland.h"
|
||||
# endif
|
||||
#elif defined(WITH_GHOST_X11)
|
||||
# include "GHOST_ContextGLX.h"
|
||||
#elif defined(WIN32)
|
||||
|
@ -113,11 +119,13 @@ class GHOST_XrGraphicsBindingOpenGL : public GHOST_IXrGraphicsBinding {
|
|||
# if defined(WITH_GL_EGL)
|
||||
GHOST_ContextEGL &ctx_egl = static_cast<GHOST_ContextEGL &>(ghost_ctx);
|
||||
|
||||
oxr_binding.egl.type = XR_TYPE_GRAPHICS_BINDING_EGL_MNDX;
|
||||
oxr_binding.egl.getProcAddress = eglGetProcAddress;
|
||||
oxr_binding.egl.display = ctx_egl.getDisplay();
|
||||
oxr_binding.egl.config = ctx_egl.getConfig();
|
||||
oxr_binding.egl.context = ctx_egl.getContext();
|
||||
if (dynamic_cast<const GHOST_SystemX11 *const>(ctx_egl.m_system)) {
|
||||
oxr_binding.egl.type = XR_TYPE_GRAPHICS_BINDING_EGL_MNDX;
|
||||
oxr_binding.egl.getProcAddress = eglGetProcAddress;
|
||||
oxr_binding.egl.display = ctx_egl.getDisplay();
|
||||
oxr_binding.egl.config = ctx_egl.getConfig();
|
||||
oxr_binding.egl.context = ctx_egl.getContext();
|
||||
}
|
||||
# else
|
||||
GHOST_ContextGLX &ctx_glx = static_cast<GHOST_ContextGLX &>(ghost_ctx);
|
||||
XVisualInfo *visual_info = glXGetVisualFromFBConfig(ctx_glx.m_display, ctx_glx.m_fbconfig);
|
||||
|
@ -139,6 +147,14 @@ class GHOST_XrGraphicsBindingOpenGL : public GHOST_IXrGraphicsBinding {
|
|||
oxr_binding.wgl.hGLRC = ctx_wgl.m_hGLRC;
|
||||
#endif
|
||||
|
||||
#if defined(WITH_GHOST_WAYLAND)
|
||||
GHOST_ContextEGL &ctx_wl_egl = static_cast<GHOST_ContextEGL &>(ghost_ctx);
|
||||
if (dynamic_cast<const GHOST_SystemWayland *const>(ctx_wl_egl.m_system)) {
|
||||
oxr_binding.wl.type = XR_TYPE_GRAPHICS_BINDING_OPENGL_WAYLAND_KHR;
|
||||
oxr_binding.wl.display = (struct wl_display *)ctx_wl_egl.m_nativeDisplay;
|
||||
}
|
||||
#endif
|
||||
|
||||
/* Generate a frame-buffer to use for blitting into the texture. */
|
||||
glGenFramebuffers(1, &m_fbo);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue