mirror of
https://github.com/MobileGL-Dev/MobileGL
synced 2026-11-20 16:31:57 +09:00
[MG_Remote, MG_Impl, MG_State, Config] (P12): MOBILEGL_IPC_SURFACE=server - headless window surfaces (NULL accepted), one ServerOwned CreateWindowSurface and no SetWindowHandle, the server's geometry into the EGL state before the create returns, and every refusal named on the client
This commit is contained in:
@@ -1056,6 +1056,53 @@ namespace MobileGL {
|
||||
return true;
|
||||
}
|
||||
|
||||
#if MOBILEGL_BUILD_DISAGGREGATED
|
||||
// P12 (on-screen server window). See Core.h. Split builds only (G1).
|
||||
EGLContext::EGLSurfaceHandle EGLContext::CreateServerOwnedWindowSurface(EGLDisplayHandle display,
|
||||
EGLConfigHandle config,
|
||||
const void* nativeWindow,
|
||||
EGLint width, EGLint height,
|
||||
Bool platformWindow) {
|
||||
const std::lock_guard<std::recursive_mutex> lock(m_mutex);
|
||||
if (!IsDisplayInitialized(display)) {
|
||||
SetError(EGL_NOT_INITIALIZED);
|
||||
return EGL_NO_SURFACE;
|
||||
}
|
||||
if (!ValidateConfigOnDisplay(display, config)) {
|
||||
SetError(EGL_BAD_CONFIG);
|
||||
return EGL_NO_SURFACE;
|
||||
}
|
||||
if (width < 0 || height < 0) {
|
||||
SetError(EGL_BAD_ATTRIBUTE);
|
||||
return EGL_NO_SURFACE;
|
||||
}
|
||||
// No EGL_BAD_NATIVE_WINDOW for a null window: the window is the server's.
|
||||
const auto surface = EncodeHandle<EGLSurfaceHandle>(m_nextSurfaceHandle++);
|
||||
m_surfaces[surface] = SurfaceObject{
|
||||
.Display = display,
|
||||
.Config = config,
|
||||
.Type = platformWindow ? SurfaceType::PlatformWindow : SurfaceType::Window,
|
||||
.NativeHandleKey = ToNativeKey(nativeWindow),
|
||||
.ClientBuffer = nullptr,
|
||||
.BufferType = EGL_NONE,
|
||||
.Width = width,
|
||||
.Height = height,
|
||||
};
|
||||
return surface;
|
||||
}
|
||||
|
||||
Bool EGLContext::SetSurfaceExtent(EGLSurfaceHandle surface, EGLint width, EGLint height) {
|
||||
const std::lock_guard<std::recursive_mutex> lock(m_mutex);
|
||||
auto surfaceIt = m_surfaces.find(surface);
|
||||
if (surfaceIt == m_surfaces.end() || width < 0 || height < 0) {
|
||||
return false;
|
||||
}
|
||||
surfaceIt->second.Width = width;
|
||||
surfaceIt->second.Height = height;
|
||||
return true;
|
||||
}
|
||||
#endif
|
||||
|
||||
Bool EGLContext::QuerySurface(EGLDisplayHandle display, EGLSurfaceHandle surface, EGLint attribute,
|
||||
EGLint* value) const {
|
||||
const std::lock_guard<std::recursive_mutex> lock(m_mutex);
|
||||
|
||||
@@ -87,6 +87,22 @@ namespace MobileGL {
|
||||
Bool ValidateSurface(EGLSurfaceHandle surface) const;
|
||||
Bool ValidateSurfaceOnDisplay(EGLDisplayHandle display, EGLSurfaceHandle surface) const;
|
||||
Bool SwapInterval(EGLDisplayHandle display, EGLint interval);
|
||||
#if MOBILEGL_BUILD_DISAGGREGATED
|
||||
// P12 (on-screen server window), MOBILEGL_IPC_SURFACE=server. A window surface whose
|
||||
// window is the SERVER's: the client's native window may be NULL (a headless client
|
||||
// has none), and the extent it asked for (EGL_WIDTH/EGL_HEIGHT; 0/0 = the server
|
||||
// window's own) stands until the server's real one arrives through SetSurfaceExtent.
|
||||
// `platformWindow` keeps eglCreatePlatformWindowSurface's surface type. Split builds
|
||||
// only: the pull build's state class is unchanged (G1).
|
||||
EGLSurfaceHandle CreateServerOwnedWindowSurface(EGLDisplayHandle display, EGLConfigHandle config,
|
||||
const void* nativeWindow, EGLint width,
|
||||
EGLint height, Bool platformWindow);
|
||||
// P12: the server's REAL extent of a surface - a server-owned window's geometry, from
|
||||
// the CreateWindowSurface reply and from every surface-changed event after it - so
|
||||
// eglQuerySurface(EGL_WIDTH/EGL_HEIGHT) answers what the server renders at. Unlike
|
||||
// ResizeSurface it needs no display (the event carries none) and keeps a 0 as 0.
|
||||
Bool SetSurfaceExtent(EGLSurfaceHandle surface, EGLint width, EGLint height);
|
||||
#endif
|
||||
|
||||
// Current
|
||||
Bool MakeCurrent(EGLDisplayHandle display, EGLSurfaceHandle draw, EGLSurfaceHandle read,
|
||||
|
||||
Reference in New Issue
Block a user