diff options
-rw-r--r-- | intern/ghost/CMakeLists.txt | 13 | ||||
-rw-r--r-- | intern/ghost/intern/GHOST_IXrGraphicsBinding.h | 3 | ||||
-rw-r--r-- | intern/ghost/intern/GHOST_XrContext.cpp | 2 | ||||
-rw-r--r-- | intern/ghost/intern/GHOST_XrGraphicsBinding.cpp | 26 |
4 files changed, 34 insertions, 10 deletions
diff --git a/intern/ghost/CMakeLists.txt b/intern/ghost/CMakeLists.txt index 1815a46591a..77ec307e604 100644 --- a/intern/ghost/CMakeLists.txt +++ b/intern/ghost/CMakeLists.txt @@ -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() diff --git a/intern/ghost/intern/GHOST_IXrGraphicsBinding.h b/intern/ghost/intern/GHOST_IXrGraphicsBinding.h index 5508d34e96c..a7339158dc4 100644 --- a/intern/ghost/intern/GHOST_IXrGraphicsBinding.h +++ b/intern/ghost/intern/GHOST_IXrGraphicsBinding.h @@ -40,6 +40,9 @@ class GHOST_IXrGraphicsBinding { XrGraphicsBindingOpenGLWin32KHR wgl; XrGraphicsBindingD3D11KHR d3d11; #endif +#if defined(WITH_GHOST_WAYLAND) + XrGraphicsBindingOpenGLWaylandKHR wl; +#endif } oxr_binding; virtual ~GHOST_IXrGraphicsBinding() = default; diff --git a/intern/ghost/intern/GHOST_XrContext.cpp b/intern/ghost/intern/GHOST_XrContext.cpp index f057e679d56..2906a6b241e 100644 --- a/intern/ghost/intern/GHOST_XrContext.cpp +++ b/intern/ghost/intern/GHOST_XrContext.cpp @@ -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 diff --git a/intern/ghost/intern/GHOST_XrGraphicsBinding.cpp b/intern/ghost/intern/GHOST_XrGraphicsBinding.cpp index aeaa6e6b9e0..dd0205ea867 100644 --- a/intern/ghost/intern/GHOST_XrGraphicsBinding.cpp +++ b/intern/ghost/intern/GHOST_XrGraphicsBinding.cpp @@ -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); } |