Changeset View
Changeset View
Standalone View
Standalone View
intern/ghost/intern/GHOST_XrGraphicsBinding.cpp
| Show All 23 Lines | |||||
| #if defined(WITH_GHOST_X11) | #if defined(WITH_GHOST_X11) | ||||
| # include "GHOST_ContextGLX.h" | # include "GHOST_ContextGLX.h" | ||||
| #elif defined(WIN32) | #elif defined(WIN32) | ||||
| # include "GHOST_ContextD3D.h" | # include "GHOST_ContextD3D.h" | ||||
| # include "GHOST_ContextWGL.h" | # include "GHOST_ContextWGL.h" | ||||
| # include "GHOST_SystemWin32.h" | # include "GHOST_SystemWin32.h" | ||||
| #endif | #endif | ||||
| #if defined(WITH_GL_EGL) | |||||
| # include "GHOST_ContextEGL.h" | |||||
| #endif | |||||
brecht: Don't include things that are not needed:
```
#if defined(WITH_GL_EGL)
# include… | |||||
| #include "GHOST_C-api.h" | #include "GHOST_C-api.h" | ||||
| #include "GHOST_Xr_intern.h" | #include "GHOST_Xr_intern.h" | ||||
| #include "GHOST_IXrGraphicsBinding.h" | #include "GHOST_IXrGraphicsBinding.h" | ||||
| static std::optional<int64_t> choose_swapchain_format_from_candidates( | static std::optional<int64_t> choose_swapchain_format_from_candidates( | ||||
| const std::vector<int64_t> &gpu_binding_formats, const std::vector<int64_t> &runtime_formats) | const std::vector<int64_t> &gpu_binding_formats, const std::vector<int64_t> &runtime_formats) | ||||
| { | { | ||||
| ▲ Show 20 Lines • Show All 60 Lines • ▼ Show 20 Lines | #endif | ||||
| } | } | ||||
| return (gl_version >= gpu_requirements.minApiVersionSupported) && | return (gl_version >= gpu_requirements.minApiVersionSupported) && | ||||
| (gl_version <= gpu_requirements.maxApiVersionSupported); | (gl_version <= gpu_requirements.maxApiVersionSupported); | ||||
| } | } | ||||
| void initFromGhostContext(GHOST_Context &ghost_ctx) override | void initFromGhostContext(GHOST_Context &ghost_ctx) override | ||||
| { | { | ||||
| #if defined(WITH_GHOST_X11) | #if defined(WITH_GHOST_X11) | ||||
| #if defined(WITH_GL_EGL) | |||||
brechtUnsubmitted Done Inline ActionsConsistency with other conditions: #if defined(WITH_GL_EGL) ... #elif defined(WITH_GHOST_X11) ... brecht: Consistency with other conditions:
```
#if defined(WITH_GL_EGL)
...
#elif defined… | |||||
christian.rauchAuthorUnsubmitted Done Inline ActionsI think the #if defined(WITH_GHOST_X11) has to stay there, because I guess we only want to use XrGraphicsBindingEGLMNDX for X11-EGL. The Wayland backend would use XrGraphicsBindingOpenGLWaylandKHR. christian.rauch: I think the `#if defined(WITH_GHOST_X11)` has to stay there, because I guess we only want to… | |||||
| 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; | |||||
brechtUnsubmitted Done Inline ActionsI think that & should be left out? From what I can tell it expects a function pointer, not a pointer to a function pointer. It's a bit confusing since this is a function pointer to a function that returns a function pointer. brecht: I think that `&` should be left out?
From what I can tell it expects a function pointer, not a… | |||||
| oxr_binding.egl.display = ctx_egl.getDisplay(); | |||||
| oxr_binding.egl.config = ctx_egl.getConfig(); | |||||
| oxr_binding.egl.context = ctx_egl.getContext(); | |||||
brechtUnsubmitted Done Inline ActionsThis seems to be missing oxr_binding.egl.next = NULL. It's missing also for other platforms which may mean it's zero initialized elsewhere. But I couldn't find that. brecht: This seems to be missing `oxr_binding.egl.next = NULL`.
It's missing also for other platforms… | |||||
christian.rauchAuthorUnsubmitted Done Inline ActionsYes, I think pointers are always initialised to NULL / nullptr. christian.rauch: Yes, I think pointers are always initialised to NULL / nullptr. | |||||
| #else | |||||
| GHOST_ContextGLX &ctx_glx = static_cast<GHOST_ContextGLX &>(ghost_ctx); | GHOST_ContextGLX &ctx_glx = static_cast<GHOST_ContextGLX &>(ghost_ctx); | ||||
| XVisualInfo *visual_info = glXGetVisualFromFBConfig(ctx_glx.m_display, ctx_glx.m_fbconfig); | XVisualInfo *visual_info = glXGetVisualFromFBConfig(ctx_glx.m_display, ctx_glx.m_fbconfig); | ||||
| oxr_binding.glx.type = XR_TYPE_GRAPHICS_BINDING_OPENGL_XLIB_KHR; | oxr_binding.glx.type = XR_TYPE_GRAPHICS_BINDING_OPENGL_XLIB_KHR; | ||||
| oxr_binding.glx.xDisplay = ctx_glx.m_display; | oxr_binding.glx.xDisplay = ctx_glx.m_display; | ||||
| oxr_binding.glx.glxFBConfig = ctx_glx.m_fbconfig; | oxr_binding.glx.glxFBConfig = ctx_glx.m_fbconfig; | ||||
| oxr_binding.glx.glxDrawable = ctx_glx.m_window; | oxr_binding.glx.glxDrawable = ctx_glx.m_window; | ||||
| oxr_binding.glx.glxContext = ctx_glx.m_context; | oxr_binding.glx.glxContext = ctx_glx.m_context; | ||||
| oxr_binding.glx.visualid = visual_info->visualid; | oxr_binding.glx.visualid = visual_info->visualid; | ||||
| XFree(visual_info); | XFree(visual_info); | ||||
| #endif | |||||
| #elif defined(WIN32) | #elif defined(WIN32) | ||||
| GHOST_ContextWGL &ctx_wgl = static_cast<GHOST_ContextWGL &>(ghost_ctx); | GHOST_ContextWGL &ctx_wgl = static_cast<GHOST_ContextWGL &>(ghost_ctx); | ||||
| oxr_binding.wgl.type = XR_TYPE_GRAPHICS_BINDING_OPENGL_WIN32_KHR; | oxr_binding.wgl.type = XR_TYPE_GRAPHICS_BINDING_OPENGL_WIN32_KHR; | ||||
| oxr_binding.wgl.hDC = ctx_wgl.m_hDC; | oxr_binding.wgl.hDC = ctx_wgl.m_hDC; | ||||
| oxr_binding.wgl.hGLRC = ctx_wgl.m_hGLRC; | oxr_binding.wgl.hGLRC = ctx_wgl.m_hGLRC; | ||||
| #endif | #endif | ||||
| ▲ Show 20 Lines • Show All 229 Lines • Show Last 20 Lines | |||||
Don't include things that are not needed: