diff options
Diffstat (limited to 'intern/ghost/intern/GHOST_XrGraphicsBinding.cpp')
-rw-r--r-- | intern/ghost/intern/GHOST_XrGraphicsBinding.cpp | 26 |
1 files changed, 21 insertions, 5 deletions
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); } |