Files
MobileGL/MobileGL/MG_Backend/BackendObject.cpp
T
swung0x48 7de09a673d [Refactor] (CMakeLists.txt, MG_Backend, MG_Backend/DirectGLES, MG_Backend/DirectVulkan, MG_Remote/Client, MG_Remote/Protocol, MG_Remote/Server, MG_Test/Backend, scripts/data): move BackendObject's EGL bookkeeping into EGLSurfaceRegistry
- EGLSurfaceRegistry owns the display, the surface records, the active surface, each thread's binding and the one recursive lock; BackendObject holds one and is its hooks, so the EGL virtuals keep their signatures and their defaults
- the backends reach it through EGLRegistry(): lookups return copies, and the steps they compose (adopting an already-bound surface, a window's surfaces, a window's new extent) are named operations instead of writes to protected fields
- WindowBackend and WindowHandle move with it
- BackendObjectEglStateTest only re-points its accessors; the same 235 mutants, carried over, get the same verdicts except three that need a kind-None record, which no call can make, and one that cannot be written against the registry
- comments that cited BackendObject.cpp line numbers name the function
2026-10-17 03:55:28 -04:00

77 lines
2.4 KiB
C++

// MobileGL - MobileGL/MG_Backend/BackendObject.cpp
// Copyright (c) 2025-2026 MobileGL-Dev
// Licensed under the GNU Lesser General Public License v3.0:
// https://www.gnu.org/licenses/gpl-3.0.txt
// https://www.gnu.org/licenses/lgpl-3.0.txt
// SPDX-License-Identifier: LGPL-3.0-only
// End of Source File Header
#include "BackendObject.h"
namespace MobileGL::MG_Backend {
Bool BackendObject::InitializeEGLDisplay(EGLDisplay dpy, EGLint* major, EGLint* minor) {
return m_egl.InitializeDisplay(dpy, major, minor);
}
Bool BackendObject::CreateEGLWindowSurface(EGLSurface surface, const WindowHandle& handle) {
return m_egl.CreateWindowSurface(surface, handle);
}
Bool BackendObject::ResizeEGLWindowSurface(EGLSurface surface, Uint32 width, Uint32 height) {
return m_egl.ResizeSurface(surface, width, height);
}
Bool BackendObject::CreateEGLPbufferSurface(EGLSurface surface, EGLint width, EGLint height) {
return m_egl.CreatePbufferSurface(surface, width, height);
}
Bool BackendObject::MakeEGLCurrent(EGLDisplay dpy, EGLSurface draw, EGLSurface read, EGLContext ctx) {
return m_egl.MakeCurrent(dpy, draw, read, ctx);
}
Bool BackendObject::SwapEGLBuffers(EGLDisplay dpy, EGLSurface draw) {
return m_egl.Swap(dpy, draw);
}
void BackendObject::ReleaseEGLSurface(EGLSurface surface) {
m_egl.ReleaseSurface(surface);
}
void BackendObject::ReleaseEGLResources() {
m_egl.ReleaseAll();
}
void BackendObject::SetWindowHandle(const WindowHandle& handle) {
m_egl.SetWindowHandle(handle);
}
void BackendObject::SetEGLSwapInterval(Int interval) {
const auto& backendFunctions = GetBackendFunctions();
if (backendFunctions.SetSwapInterval) {
backendFunctions.SetSwapInterval(interval);
}
}
const FormatCapabilityCache& BackendObject::GetFormatCapabilities() const {
return m_formatCapabilities;
}
FormatCapabilityCache& BackendObject::MutableFormatCapabilities() {
return m_formatCapabilities;
}
Bool BackendObject::InitPbufferSurface(EGLint width, EGLint height) {
(void)width;
(void)height;
return false;
}
void BackendObject::OnEGLSurfaceReleased(EGLSurface surface) {
(void)surface;
}
void BackendObject::OnEGLSurfaceForgotten(EGLSurface surface) {
(void)surface;
}
} // namespace MobileGL::MG_Backend