mirror of
https://github.com/MobileGL-Dev/MobileGL
synced 2026-09-18 09:08:31 +09:00
[Feat|Refactor] (MG_Backend|MG_Impl): Implement BackendObject, replacing previous methods.
This commit is contained in:
@@ -0,0 +1,253 @@
|
||||
// MobileGL - MobileGL/MG_Impl/EGLImpl/EGLImpl.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 "EGLImpl.h"
|
||||
#include "EGL/egl.h"
|
||||
#include <MG_Backend/BackendObjects.h>
|
||||
|
||||
namespace MobileGL::MG_Impl::EGLImpl {
|
||||
EGLSurface CreateWindowSurface(EGLDisplay dpy, EGLConfig config, NativeWindowType window,
|
||||
const EGLint* attrib_list) {
|
||||
MGLOG_D("EGLImpl::CreateWindowSurface called with window=%p", window);
|
||||
const auto& activeBackendObject = MG_Backend::pActiveBackendObject;
|
||||
if (!activeBackendObject) {
|
||||
MGLOG_E("activeBackendObject not initialized!");
|
||||
return EGL_NO_SURFACE;
|
||||
}
|
||||
activeBackendObject->SetWindowHandle({MG_Backend::WindowBackend::Android, reinterpret_cast<void*>(window)});
|
||||
activeBackendObject->InitWindowSurface();
|
||||
glClearColor(1, 1, 1, 1);
|
||||
glClear(GL_COLOR_BUFFER_BIT);
|
||||
SwapBuffers((EGLDisplay)1, (EGLSurface)1);
|
||||
return (EGLSurface)1;
|
||||
}
|
||||
|
||||
EGLBoolean SwapBuffers(EGLDisplay dpy, EGLSurface draw) {
|
||||
MGLOG_D("EGLImpl::SwapBuffers called with dpy=%p", dpy);
|
||||
if (!MG_Backend::gBackendFunctionsTable.Present) {
|
||||
MGLOG_E("MG_Backend::gBackendFunctionsTable.Present not initialized!");
|
||||
return EGL_FALSE;
|
||||
}
|
||||
MG_Backend::gBackendFunctionsTable.Present();
|
||||
return EGL_TRUE;
|
||||
}
|
||||
|
||||
EGLBoolean ChooseConfig(EGLDisplay dpy, const EGLint* attrib_list, EGLConfig* configs, EGLint config_size,
|
||||
EGLint* num_config) {
|
||||
*num_config = 1;
|
||||
return EGL_TRUE;
|
||||
}
|
||||
|
||||
EGLContext CreateContext(EGLDisplay dpy, EGLConfig config, EGLContext shareCtx, const EGLint* attrib_list) {
|
||||
return (EGLContext)1;
|
||||
}
|
||||
|
||||
EGLBoolean Initialize(EGLDisplay dpy, EGLint* major, EGLint* minor) {
|
||||
if (major) *major = 1;
|
||||
if (minor) *minor = 5;
|
||||
return EGL_TRUE;
|
||||
}
|
||||
|
||||
EGLDisplay GetDisplay(NativeDisplayType display) {
|
||||
return (EGLDisplay)1;
|
||||
}
|
||||
|
||||
EGLint GetError() {
|
||||
return EGL_SUCCESS;
|
||||
}
|
||||
|
||||
EGLBoolean MakeCurrent(EGLDisplay dpy, EGLSurface draw, EGLSurface read, EGLContext ctx) {
|
||||
return EGL_TRUE;
|
||||
}
|
||||
|
||||
EGLBoolean DestroyContext(EGLDisplay dpy, EGLContext ctx) {
|
||||
return EGL_TRUE;
|
||||
}
|
||||
|
||||
EGLBoolean DestroySurface(EGLDisplay dpy, EGLSurface surface) {
|
||||
return EGL_TRUE;
|
||||
}
|
||||
|
||||
EGLBoolean Terminate(EGLDisplay dpy) {
|
||||
return EGL_TRUE;
|
||||
}
|
||||
|
||||
EGLBoolean ReleaseThread() {
|
||||
return EGL_TRUE;
|
||||
}
|
||||
|
||||
EGLContext GetCurrentContext() {
|
||||
return (EGLContext)1;
|
||||
}
|
||||
|
||||
EGLBoolean GetConfigAttrib(EGLDisplay dpy, EGLConfig config, EGLint attribute, EGLint* value) {
|
||||
if (attribute == EGL_NATIVE_VISUAL_ID) {
|
||||
#if defined(ANDROID)
|
||||
*value = AHARDWAREBUFFER_FORMAT_R8G8B8A8_UNORM;
|
||||
return EGL_TRUE;
|
||||
#elif defined(__linux__)
|
||||
*value = 0;
|
||||
return EGL_TRUE;
|
||||
#elif defined(_WIN32)
|
||||
*value = 0;
|
||||
return EGL_TRUE;
|
||||
#else
|
||||
*value = 0;
|
||||
return EGL_FALSE;
|
||||
#endif
|
||||
}
|
||||
return EGL_TRUE;
|
||||
}
|
||||
|
||||
EGLBoolean BindAPI(EGLenum api) {
|
||||
return EGL_TRUE;
|
||||
}
|
||||
|
||||
EGLSurface GetCurrentSurface(EGLint readdraw) {
|
||||
return (EGLSurface)1;
|
||||
}
|
||||
|
||||
EGLBoolean QuerySurface(EGLDisplay display, EGLSurface surface, EGLint attribute, EGLint* value) {
|
||||
return EGL_TRUE;
|
||||
}
|
||||
|
||||
char const* QueryString(EGLDisplay display, EGLint name) {
|
||||
return "";
|
||||
}
|
||||
|
||||
EGLBoolean SwapInterval(EGLDisplay dpy, EGLint interval) {
|
||||
return EGL_TRUE;
|
||||
}
|
||||
|
||||
EGLSurface CreatePbufferSurface(EGLDisplay dpy, EGLConfig config, const EGLint* attrib_list) {
|
||||
return (EGLSurface)1;
|
||||
}
|
||||
|
||||
EGLBoolean BindTexImage(EGLDisplay dpy, EGLSurface surface, EGLint buffer) {
|
||||
return EGL_TRUE;
|
||||
}
|
||||
|
||||
EGLBoolean ReleaseTexImage(EGLDisplay dpy, EGLSurface surface, EGLint buffer) {
|
||||
return EGL_TRUE;
|
||||
}
|
||||
|
||||
EGLBoolean CopyBuffers(EGLDisplay dpy, EGLSurface surface, EGLNativePixmapType target) {
|
||||
return EGL_TRUE;
|
||||
}
|
||||
|
||||
EGLSurface CreatePbufferFromClientBuffer(EGLDisplay dpy, EGLenum buftype, EGLClientBuffer buffer, EGLConfig config,
|
||||
const EGLint* attrib_list) {
|
||||
return (EGLSurface)1;
|
||||
}
|
||||
|
||||
EGLSurface CreatePixmapSurface(EGLDisplay dpy, EGLConfig config, EGLNativePixmapType pixmap,
|
||||
const EGLint* attrib_list) {
|
||||
return (EGLSurface)1;
|
||||
}
|
||||
|
||||
EGLBoolean GetConfigs(EGLDisplay dpy, EGLConfig* configs, EGLint config_size, EGLint* num_config) {
|
||||
if (num_config) {
|
||||
*num_config = 1;
|
||||
}
|
||||
if (configs && config_size > 0) {
|
||||
configs[0] = (EGLConfig)1;
|
||||
}
|
||||
return EGL_TRUE;
|
||||
}
|
||||
|
||||
EGLDisplay GetCurrentDisplay() {
|
||||
return (EGLDisplay)1;
|
||||
}
|
||||
|
||||
EGLenum QueryAPI() {
|
||||
return EGL_OPENGL_API;
|
||||
}
|
||||
|
||||
EGLBoolean QueryContext(EGLDisplay dpy, EGLContext ctx, EGLint attribute, EGLint* value) {
|
||||
if (value) {
|
||||
*value = 1;
|
||||
}
|
||||
return EGL_TRUE;
|
||||
}
|
||||
|
||||
EGLBoolean SurfaceAttrib(EGLDisplay dpy, EGLSurface surface, EGLint attribute, EGLint value) {
|
||||
return EGL_TRUE;
|
||||
}
|
||||
|
||||
EGLBoolean WaitClient() {
|
||||
return EGL_TRUE;
|
||||
}
|
||||
|
||||
EGLBoolean WaitGL() {
|
||||
return EGL_TRUE;
|
||||
}
|
||||
|
||||
EGLBoolean WaitNative(EGLint engine) {
|
||||
return EGL_TRUE;
|
||||
}
|
||||
|
||||
EGLSync CreateSync(EGLDisplay dpy, EGLenum type, const EGLAttrib* attrib_list) {
|
||||
return reinterpret_cast<EGLSync>(0x1);
|
||||
}
|
||||
|
||||
EGLBoolean DestroySync(void* dpy, void* sync) {
|
||||
return EGL_TRUE;
|
||||
}
|
||||
|
||||
EGLint ClientWaitSync(EGLDisplay dpy, EGLSync sync, EGLint flags, EGLTime timeout) {
|
||||
return EGL_CONDITION_SATISFIED;
|
||||
}
|
||||
|
||||
EGLBoolean GetSyncAttrib(EGLDisplay dpy, EGLSync sync, EGLint attribute, EGLAttrib* value) {
|
||||
if (value) {
|
||||
*value = 1;
|
||||
}
|
||||
return EGL_TRUE;
|
||||
}
|
||||
|
||||
EGLImage CreateImage(EGLDisplay dpy, EGLContext ctx, EGLenum target, EGLClientBuffer buffer,
|
||||
const EGLAttrib* attrib_list) {
|
||||
return reinterpret_cast<EGLImage>(0x1);
|
||||
}
|
||||
|
||||
EGLBoolean DestroyImage(EGLDisplay dpy, EGLImage image) {
|
||||
return EGL_TRUE;
|
||||
}
|
||||
|
||||
EGLDisplay GetPlatformDisplay(EGLenum platform, void* native_display, const EGLAttrib* attrib_list) {
|
||||
return reinterpret_cast<EGLDisplay>(0x1);
|
||||
}
|
||||
|
||||
EGLSurface CreatePlatformWindowSurface(EGLDisplay dpy, EGLConfig config, void* native_window,
|
||||
const EGLAttrib* attrib_list) {
|
||||
return reinterpret_cast<EGLSurface>(0x1);
|
||||
}
|
||||
|
||||
EGLSurface CreatePlatformPixmapSurface(EGLDisplay dpy, EGLConfig config, void* native_pixmap,
|
||||
const EGLAttrib* attrib_list) {
|
||||
return reinterpret_cast<EGLSurface>(0x1);
|
||||
}
|
||||
|
||||
EGLBoolean WaitSync(void* dpy, void* sync, int flags) {
|
||||
return EGL_TRUE;
|
||||
}
|
||||
|
||||
__eglMustCastToProperFunctionPointerType GetProcAddress(const char* name) {
|
||||
MGLOG_D("eglGetProcAddress(%s)", name);
|
||||
#if !defined(WIN32) && !defined(__APPLE__)
|
||||
void* proc = dlsym(RTLD_DEFAULT, (const char*)name);
|
||||
#else
|
||||
void* proc = NULL;
|
||||
#endif
|
||||
if (!proc) {
|
||||
MGLOG_W("Failed to get function: %s", (const char*)name);
|
||||
return nullptr;
|
||||
}
|
||||
return (__eglMustCastToProperFunctionPointerType)proc;
|
||||
}
|
||||
} // namespace MobileGL::MG_Impl::EGLImpl
|
||||
@@ -0,0 +1,64 @@
|
||||
// MobileGL - MobileGL/MG_Impl/EGLImpl/EGLImpl.h
|
||||
// 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
|
||||
|
||||
#pragma once
|
||||
#include <Includes.h>
|
||||
|
||||
namespace MobileGL::MG_Impl::EGLImpl {
|
||||
EGLSurface CreateWindowSurface(EGLDisplay dpy, EGLConfig config, NativeWindowType window,
|
||||
const EGLint* attrib_list);
|
||||
EGLBoolean SwapBuffers(EGLDisplay dpy, EGLSurface draw);
|
||||
EGLBoolean ChooseConfig(EGLDisplay dpy, const EGLint* attrib_list, EGLConfig* configs, EGLint config_size,
|
||||
EGLint* num_config);
|
||||
EGLContext CreateContext(EGLDisplay dpy, EGLConfig config, EGLContext shareCtx, const EGLint* attrib_list);
|
||||
EGLBoolean Initialize(EGLDisplay dpy, EGLint* major, EGLint* minor);
|
||||
EGLDisplay GetDisplay(NativeDisplayType display);
|
||||
EGLint GetError();
|
||||
EGLBoolean MakeCurrent(EGLDisplay dpy, EGLSurface draw, EGLSurface read, EGLContext ctx);
|
||||
EGLBoolean DestroyContext(EGLDisplay dpy, EGLContext ctx);
|
||||
EGLBoolean DestroySurface(EGLDisplay dpy, EGLSurface surface);
|
||||
EGLBoolean Terminate(EGLDisplay dpy);
|
||||
EGLBoolean ReleaseThread();
|
||||
EGLContext GetCurrentContext();
|
||||
EGLBoolean GetConfigAttrib(EGLDisplay dpy, EGLConfig config, EGLint attribute, EGLint* value);
|
||||
EGLBoolean BindAPI(EGLenum api);
|
||||
EGLSurface GetCurrentSurface(EGLint readdraw);
|
||||
EGLBoolean QuerySurface(EGLDisplay display, EGLSurface surface, EGLint attribute, EGLint* value);
|
||||
const char* QueryString(EGLDisplay display, EGLint name);
|
||||
EGLBoolean SwapInterval(EGLDisplay dpy, EGLint interval);
|
||||
EGLSurface CreatePbufferSurface(EGLDisplay dpy, EGLConfig config, const EGLint* attrib_list);
|
||||
EGLBoolean BindTexImage(EGLDisplay dpy, EGLSurface surface, EGLint buffer);
|
||||
EGLBoolean ReleaseTexImage(EGLDisplay dpy, EGLSurface surface, EGLint buffer);
|
||||
EGLBoolean CopyBuffers(EGLDisplay dpy, EGLSurface surface, EGLNativePixmapType target);
|
||||
EGLSurface CreatePbufferFromClientBuffer(EGLDisplay dpy, EGLenum buftype, EGLClientBuffer buffer, EGLConfig config,
|
||||
const EGLint* attrib_list);
|
||||
EGLSurface CreatePixmapSurface(EGLDisplay dpy, EGLConfig config, EGLNativePixmapType pixmap,
|
||||
const EGLint* attrib_list);
|
||||
EGLBoolean GetConfigs(EGLDisplay dpy, EGLConfig* configs, EGLint config_size, EGLint* num_config);
|
||||
EGLDisplay GetCurrentDisplay();
|
||||
EGLenum QueryAPI();
|
||||
EGLBoolean QueryContext(EGLDisplay dpy, EGLContext ctx, EGLint attribute, EGLint* value);
|
||||
EGLBoolean SurfaceAttrib(EGLDisplay dpy, EGLSurface surface, EGLint attribute, EGLint value);
|
||||
EGLBoolean WaitClient();
|
||||
EGLBoolean WaitGL();
|
||||
EGLBoolean WaitNative(EGLint engine);
|
||||
EGLSync CreateSync(EGLDisplay dpy, EGLenum type, const EGLAttrib* attrib_list);
|
||||
EGLBoolean DestroySync(void* dpy, void* sync);
|
||||
EGLint ClientWaitSync(EGLDisplay dpy, EGLSync sync, EGLint flags, EGLTime timeout);
|
||||
EGLBoolean GetSyncAttrib(EGLDisplay dpy, EGLSync sync, EGLint attribute, EGLAttrib* value);
|
||||
EGLImage CreateImage(EGLDisplay dpy, EGLContext ctx, EGLenum target, EGLClientBuffer buffer,
|
||||
const EGLAttrib* attrib_list);
|
||||
EGLBoolean DestroyImage(EGLDisplay dpy, EGLImage image);
|
||||
EGLDisplay GetPlatformDisplay(EGLenum platform, void* native_display, const EGLAttrib* attrib_list);
|
||||
EGLSurface CreatePlatformWindowSurface(EGLDisplay dpy, EGLConfig config, void* native_window,
|
||||
const EGLAttrib* attrib_list);
|
||||
EGLSurface CreatePlatformPixmapSurface(EGLDisplay dpy, EGLConfig config, void* native_pixmap,
|
||||
const EGLAttrib* attrib_list);
|
||||
EGLBoolean WaitSync(void* dpy, void* sync, int flags);
|
||||
__eglMustCastToProperFunctionPointerType GetProcAddress(const char* name);
|
||||
} // namespace MobileGL::MG_Impl::EGLImpl
|
||||
@@ -1,218 +0,0 @@
|
||||
// MobileGL - MobileGL/MG_Impl/EGLImpl/EGLWrapper/EGLWrapper.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 "EGLWrapper.h"
|
||||
|
||||
#include "MG_Impl/GetProcAddress.h"
|
||||
|
||||
#include <Config.h>
|
||||
#include <MG_Util/BackendLoaders/OpenGL/Loader.h>
|
||||
|
||||
#if MOBILEGL_BACKEND == MOBILEGL_BACKEND_TYPE_DIRECT_GLES
|
||||
namespace MobileGL {
|
||||
namespace MG_Impl::EGLImpl {
|
||||
// TODO: implement complete EGL functionality
|
||||
|
||||
EGLSurface CreateWindowSurface(EGLDisplay dpy, EGLConfig config, NativeWindowType window,
|
||||
const EGLint* attrib_list) {
|
||||
return MG_External::EGL::eglCreateWindowSurface(dpy, config, window, attrib_list);
|
||||
}
|
||||
|
||||
EGLBoolean ChooseConfig(EGLDisplay dpy, const EGLint* attrib_list, EGLConfig* configs, EGLint config_size,
|
||||
EGLint* num_config) {
|
||||
return MG_External::EGL::eglChooseConfig(dpy, attrib_list, configs, config_size, num_config);
|
||||
}
|
||||
|
||||
EGLContext CreateContext(EGLDisplay dpy, EGLConfig config, EGLContext shareCtx, const EGLint* attrib_list) {
|
||||
return MG_External::EGL::eglCreateContext(dpy, config, shareCtx, attrib_list);
|
||||
}
|
||||
|
||||
EGLBoolean Initialize(EGLDisplay dpy, EGLint* major, EGLint* minor) {
|
||||
return MG_External::EGL::eglInitialize(dpy, major, minor);
|
||||
}
|
||||
|
||||
EGLDisplay GetDisplay(NativeDisplayType display) {
|
||||
return MG_External::EGL::eglGetDisplay(display);
|
||||
}
|
||||
|
||||
EGLint GetError() {
|
||||
return MG_External::EGL::eglGetError();
|
||||
}
|
||||
|
||||
EGLBoolean MakeCurrent(EGLDisplay dpy, EGLSurface draw, EGLSurface read, EGLContext ctx) {
|
||||
return MG_External::EGL::eglMakeCurrent(dpy, draw, read, ctx);
|
||||
}
|
||||
|
||||
EGLBoolean DestroyContext(EGLDisplay dpy, EGLContext ctx) {
|
||||
return MG_External::EGL::eglDestroyContext(dpy, ctx);
|
||||
}
|
||||
|
||||
EGLBoolean DestroySurface(EGLDisplay dpy, EGLSurface surface) {
|
||||
return MG_External::EGL::eglDestroySurface(dpy, surface);
|
||||
}
|
||||
|
||||
EGLBoolean Terminate(EGLDisplay dpy) {
|
||||
return MG_External::EGL::eglTerminate(dpy);
|
||||
}
|
||||
|
||||
EGLBoolean ReleaseThread(void) {
|
||||
return MG_External::EGL::eglReleaseThread();
|
||||
}
|
||||
|
||||
EGLContext GetCurrentContext(void) {
|
||||
return MG_External::EGL::eglGetCurrentContext();
|
||||
}
|
||||
|
||||
EGLBoolean GetConfigAttrib(EGLDisplay dpy, EGLConfig config, EGLint attribute, EGLint* value) {
|
||||
return MG_External::EGL::eglGetConfigAttrib(dpy, config, attribute, value);
|
||||
}
|
||||
|
||||
EGLBoolean BindAPI(EGLenum api) {
|
||||
// We should accept `EGL_OPENGL_API`,
|
||||
// and bind to `EGL_OPENGL_ES_API` at the backend
|
||||
MGLOG_D("%s: api = %s", __func__, api == EGL_OPENGL_API ? "EGL_OPENGL_API" : "EGL_OPENGL_ES_API");
|
||||
MGLOG_D("%s: calling backend as EGL_OPENGL_ES_API", __func__);
|
||||
return MG_External::EGL::eglBindAPI(EGL_OPENGL_ES_API);
|
||||
}
|
||||
|
||||
EGLSurface GetCurrentSurface(EGLint readdraw) {
|
||||
return MG_External::EGL::eglGetCurrentSurface(readdraw);
|
||||
}
|
||||
|
||||
EGLBoolean QuerySurface(EGLDisplay display, EGLSurface surface, EGLint attribute, EGLint* value) {
|
||||
return MG_External::EGL::eglQuerySurface(display, surface, attribute, value);
|
||||
}
|
||||
|
||||
char const* QueryString(EGLDisplay display, EGLint name) {
|
||||
return MG_External::EGL::eglQueryString(display, name);
|
||||
}
|
||||
|
||||
EGLBoolean SwapInterval(EGLDisplay dpy, EGLint interval) {
|
||||
return MG_External::EGL::eglSwapInterval(dpy, interval);
|
||||
}
|
||||
|
||||
EGLBoolean SwapBuffers(EGLDisplay dpy, EGLSurface draw) {
|
||||
return MG_External::EGL::eglSwapBuffers(dpy, draw);
|
||||
}
|
||||
|
||||
EGLSurface CreatePbufferSurface(EGLDisplay dpy, EGLConfig config, const EGLint* attrib_list) {
|
||||
return MG_External::EGL::eglCreatePbufferSurface(dpy, config, attrib_list);
|
||||
}
|
||||
|
||||
EGLBoolean BindTexImage(EGLDisplay dpy, EGLSurface surface, EGLint buffer) {
|
||||
return MG_External::EGL::eglBindTexImage(dpy, surface, buffer);
|
||||
}
|
||||
|
||||
EGLBoolean ReleaseTexImage(EGLDisplay dpy, EGLSurface surface, EGLint buffer) {
|
||||
return MG_External::EGL::eglReleaseTexImage(dpy, surface, buffer);
|
||||
}
|
||||
|
||||
EGLBoolean CopyBuffers(EGLDisplay dpy, EGLSurface surface, EGLNativePixmapType target) {
|
||||
return MG_External::EGL::eglCopyBuffers(dpy, surface, target);
|
||||
}
|
||||
|
||||
EGLSurface CreatePbufferFromClientBuffer(EGLDisplay dpy, EGLenum buftype, EGLClientBuffer buffer,
|
||||
EGLConfig config, const EGLint* attrib_list) {
|
||||
return MG_External::EGL::eglCreatePbufferFromClientBuffer(dpy, buftype, buffer, config, attrib_list);
|
||||
}
|
||||
|
||||
EGLSurface CreatePixmapSurface(EGLDisplay dpy, EGLConfig config, EGLNativePixmapType pixmap,
|
||||
const EGLint* attrib_list) {
|
||||
return MG_External::EGL::eglCreatePixmapSurface(dpy, config, pixmap, attrib_list);
|
||||
}
|
||||
|
||||
EGLBoolean GetConfigs(EGLDisplay dpy, EGLConfig* configs, EGLint config_size, EGLint* num_config) {
|
||||
return MG_External::EGL::eglGetConfigs(dpy, configs, config_size, num_config);
|
||||
}
|
||||
|
||||
EGLDisplay GetCurrentDisplay(void) {
|
||||
return MG_External::EGL::eglGetCurrentDisplay();
|
||||
}
|
||||
|
||||
EGLenum QueryAPI(void) {
|
||||
return MG_External::EGL::eglQueryAPI();
|
||||
}
|
||||
|
||||
EGLBoolean QueryContext(EGLDisplay dpy, EGLContext ctx, EGLint attribute, EGLint* value) {
|
||||
return MG_External::EGL::eglQueryContext(dpy, ctx, attribute, value);
|
||||
}
|
||||
|
||||
EGLBoolean SurfaceAttrib(EGLDisplay dpy, EGLSurface surface, EGLint attribute, EGLint value) {
|
||||
return MG_External::EGL::eglSurfaceAttrib(dpy, surface, attribute, value);
|
||||
}
|
||||
|
||||
EGLBoolean WaitClient(void) {
|
||||
return MG_External::EGL::eglWaitClient();
|
||||
}
|
||||
|
||||
EGLBoolean WaitGL(void) {
|
||||
return MG_External::EGL::eglWaitGL();
|
||||
}
|
||||
|
||||
EGLBoolean WaitNative(EGLint engine) {
|
||||
return MG_External::EGL::eglWaitNative(engine);
|
||||
}
|
||||
|
||||
__eglMustCastToProperFunctionPointerType GetProcAddress(const char* name) {
|
||||
MGLOG_D("eglGetProcAddress(%s)", name);
|
||||
|
||||
void* proc = MG_Impl::GetProcAddress(name);
|
||||
|
||||
if (!proc) {
|
||||
MGLOG_W("Failed to get function: %s", (const char*)name);
|
||||
return nullptr;
|
||||
}
|
||||
return (__eglMustCastToProperFunctionPointerType)proc;
|
||||
}
|
||||
|
||||
EGLSync CreateSync(EGLDisplay dpy, EGLenum type, const EGLAttrib* attrib_list) {
|
||||
return MG_External::EGL::eglCreateSync(dpy, type, attrib_list);
|
||||
}
|
||||
|
||||
EGLBoolean DestroySync(EGLDisplay dpy, EGLSync sync) {
|
||||
return MG_External::EGL::eglDestroySync(dpy, sync);
|
||||
}
|
||||
|
||||
EGLint ClientWaitSync(EGLDisplay dpy, EGLSync sync, EGLint flags, EGLTime timeout) {
|
||||
return MG_External::EGL::eglClientWaitSync(dpy, sync, flags, timeout);
|
||||
}
|
||||
|
||||
EGLBoolean GetSyncAttrib(EGLDisplay dpy, EGLSync sync, EGLint attribute, EGLAttrib* value) {
|
||||
return MG_External::EGL::eglGetSyncAttrib(dpy, sync, attribute, value);
|
||||
}
|
||||
|
||||
EGLImage CreateImage(EGLDisplay dpy, EGLContext ctx, EGLenum target, EGLClientBuffer buffer,
|
||||
const EGLAttrib* attrib_list) {
|
||||
return MG_External::EGL::eglCreateImage(dpy, ctx, target, buffer, attrib_list);
|
||||
}
|
||||
|
||||
EGLBoolean DestroyImage(EGLDisplay dpy, EGLImage image) {
|
||||
return MG_External::EGL::eglDestroyImage(dpy, image);
|
||||
}
|
||||
|
||||
EGLDisplay GetPlatformDisplay(EGLenum platform, void* native_display, const EGLAttrib* attrib_list) {
|
||||
return MG_External::EGL::eglGetPlatformDisplay(platform, native_display, attrib_list);
|
||||
}
|
||||
|
||||
EGLSurface CreatePlatformWindowSurface(EGLDisplay dpy, EGLConfig config, void* native_window,
|
||||
const EGLAttrib* attrib_list) {
|
||||
return MG_External::EGL::eglCreatePlatformWindowSurface(dpy, config, native_window, attrib_list);
|
||||
}
|
||||
|
||||
EGLSurface CreatePlatformPixmapSurface(EGLDisplay dpy, EGLConfig config, void* native_pixmap,
|
||||
const EGLAttrib* attrib_list) {
|
||||
return MG_External::EGL::eglCreatePlatformPixmapSurface(dpy, config, native_pixmap, attrib_list);
|
||||
}
|
||||
|
||||
EGLBoolean WaitSync(EGLDisplay dpy, EGLSync sync, EGLint flags) {
|
||||
return MG_External::EGL::eglWaitSync(dpy, sync, flags);
|
||||
}
|
||||
} // namespace MG_Impl::EGLImpl
|
||||
} // namespace MobileGL
|
||||
|
||||
#endif
|
||||
@@ -1,10 +0,0 @@
|
||||
// MobileGL - MobileGL/MG_Impl/EGLImpl/EGLWrapper/EGLWrapper.h
|
||||
// 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
|
||||
|
||||
#pragma once
|
||||
#include <Includes.h>
|
||||
@@ -7,20 +7,26 @@
|
||||
// End of Source File Header
|
||||
|
||||
#include <Includes.h>
|
||||
#include "../Temporary/TemporaryEGLImpl.h"
|
||||
#include "../EGLImpl.h"
|
||||
|
||||
MOBILEGL_EGL_API EGLSurface eglCreateWindowSurface(EGLDisplay dpy, EGLConfig config, NativeWindowType window,
|
||||
const EGLint* attrib_list) {
|
||||
MGLOG_D("[MobileGL] eglCreateWindowSurface(dpy=%p, config=%p, window=%p, attrib_list=%p)", dpy, config, window,
|
||||
attrib_list);
|
||||
return MobileGL::MG_Impl::EGLImpl::CreateWindowSurface(dpy, config, window, attrib_list);
|
||||
}
|
||||
|
||||
MOBILEGL_EGL_API EGLBoolean eglChooseConfig(EGLDisplay dpy, const EGLint* attrib_list, EGLConfig* configs,
|
||||
EGLint config_size, EGLint* num_config) {
|
||||
MGLOG_D("[MobileGL] eglChooseConfig(dpy=%p, attrib_list=%p, configs=%p, config_size=%d, num_config=%p)", dpy,
|
||||
attrib_list, configs, config_size, num_config);
|
||||
return MobileGL::MG_Impl::EGLImpl::ChooseConfig(dpy, attrib_list, configs, config_size, num_config);
|
||||
}
|
||||
|
||||
MOBILEGL_EGL_API EGLContext eglCreateContext(EGLDisplay dpy, EGLConfig config, EGLContext shareCtx,
|
||||
const EGLint* attrib_list) {
|
||||
MGLOG_D("[MobileGL] eglCreateContext(dpy=%p, config=%p, shareCtx=%p, attrib_list=%p)", dpy, config, shareCtx,
|
||||
attrib_list);
|
||||
#ifdef TRACY_ENABLE
|
||||
tracy::StartupProfiler();
|
||||
#endif
|
||||
@@ -28,22 +34,27 @@ MOBILEGL_EGL_API EGLContext eglCreateContext(EGLDisplay dpy, EGLConfig config, E
|
||||
}
|
||||
|
||||
MOBILEGL_EGL_API EGLBoolean eglInitialize(EGLDisplay dpy, EGLint* major, EGLint* minor) {
|
||||
MGLOG_D("[MobileGL] eglInitialize(dpy=%p, major=%p, minor=%p)", dpy, major, minor);
|
||||
return MobileGL::MG_Impl::EGLImpl::Initialize(dpy, major, minor);
|
||||
}
|
||||
|
||||
MOBILEGL_EGL_API EGLDisplay eglGetDisplay(NativeDisplayType display) {
|
||||
MGLOG_D("[MobileGL] eglGetDisplay(display=%p)", display);
|
||||
return MobileGL::MG_Impl::EGLImpl::GetDisplay(display);
|
||||
}
|
||||
|
||||
MOBILEGL_EGL_API EGLint eglGetError() {
|
||||
MGLOG_D("[MobileGL] eglGetError()");
|
||||
return MobileGL::MG_Impl::EGLImpl::GetError();
|
||||
}
|
||||
|
||||
MOBILEGL_EGL_API EGLBoolean eglMakeCurrent(EGLDisplay dpy, EGLSurface draw, EGLSurface read, EGLContext ctx) {
|
||||
MGLOG_D("[MobileGL] eglMakeCurrent(dpy=%p, draw=%p, read=%p, ctx=%p)", dpy, draw, read, ctx);
|
||||
return MobileGL::MG_Impl::EGLImpl::MakeCurrent(dpy, draw, read, ctx);
|
||||
}
|
||||
|
||||
MOBILEGL_EGL_API EGLBoolean eglDestroyContext(EGLDisplay dpy, EGLContext ctx) {
|
||||
MGLOG_D("[MobileGL] eglDestroyContext(dpy=%p, ctx=%p)", dpy, ctx);
|
||||
#ifdef TRACY_ENABLE
|
||||
tracy::ShutdownProfiler();
|
||||
#endif
|
||||
@@ -51,46 +62,58 @@ MOBILEGL_EGL_API EGLBoolean eglDestroyContext(EGLDisplay dpy, EGLContext ctx) {
|
||||
}
|
||||
|
||||
MOBILEGL_EGL_API EGLBoolean eglDestroySurface(EGLDisplay dpy, EGLSurface surface) {
|
||||
MGLOG_D("[MobileGL] eglDestroySurface(dpy=%p, surface=%p)", dpy, surface);
|
||||
return MobileGL::MG_Impl::EGLImpl::DestroySurface(dpy, surface);
|
||||
}
|
||||
|
||||
MOBILEGL_EGL_API EGLBoolean eglTerminate(EGLDisplay dpy) {
|
||||
MGLOG_D("[MobileGL] eglTerminate(dpy=%p)", dpy);
|
||||
return MobileGL::MG_Impl::EGLImpl::Terminate(dpy);
|
||||
}
|
||||
|
||||
MOBILEGL_EGL_API EGLBoolean eglReleaseThread(void) {
|
||||
MGLOG_D("[MobileGL] eglReleaseThread()");
|
||||
return MobileGL::MG_Impl::EGLImpl::ReleaseThread();
|
||||
}
|
||||
|
||||
MOBILEGL_EGL_API EGLContext eglGetCurrentContext(void) {
|
||||
MGLOG_D("[MobileGL] eglGetCurrentContext()");
|
||||
return MobileGL::MG_Impl::EGLImpl::GetCurrentContext();
|
||||
}
|
||||
|
||||
MOBILEGL_EGL_API EGLBoolean eglGetConfigAttrib(EGLDisplay dpy, EGLConfig config, EGLint attribute, EGLint* value) {
|
||||
MGLOG_D("[MobileGL] eglGetConfigAttrib(dpy=%p, config=%p, attribute=%d, value=%p)", dpy, config, attribute, value);
|
||||
return MobileGL::MG_Impl::EGLImpl::GetConfigAttrib(dpy, config, attribute, value);
|
||||
}
|
||||
|
||||
MOBILEGL_EGL_API EGLBoolean eglBindAPI(EGLenum api) {
|
||||
MGLOG_D("[MobileGL] eglBindAPI(api=%u)", api);
|
||||
return MobileGL::MG_Impl::EGLImpl::BindAPI(api);
|
||||
}
|
||||
|
||||
MOBILEGL_EGL_API EGLSurface eglGetCurrentSurface(EGLint readdraw) {
|
||||
MGLOG_D("[MobileGL] eglGetCurrentSurface(readdraw=%d)", readdraw);
|
||||
return MobileGL::MG_Impl::EGLImpl::GetCurrentSurface(readdraw);
|
||||
}
|
||||
|
||||
MOBILEGL_EGL_API EGLBoolean eglQuerySurface(EGLDisplay display, EGLSurface surface, EGLint attribute, EGLint* value) {
|
||||
MGLOG_D("[MobileGL] eglQuerySurface(display=%p, surface=%p, attribute=%d, value=%p)", display, surface, attribute,
|
||||
value);
|
||||
return MobileGL::MG_Impl::EGLImpl::QuerySurface(display, surface, attribute, value);
|
||||
}
|
||||
|
||||
MOBILEGL_EGL_API char const * eglQueryString(EGLDisplay display, EGLint name) {
|
||||
MOBILEGL_EGL_API char const* eglQueryString(EGLDisplay display, EGLint name) {
|
||||
MGLOG_D("[MobileGL] eglQueryString(display=%p, name=%d)", display, name);
|
||||
return MobileGL::MG_Impl::EGLImpl::QueryString(display, name);
|
||||
}
|
||||
|
||||
MOBILEGL_EGL_API EGLBoolean eglSwapInterval(EGLDisplay dpy, EGLint interval) {
|
||||
MGLOG_D("[MobileGL] eglSwapInterval(dpy=%p, interval=%d)", dpy, interval);
|
||||
return MobileGL::MG_Impl::EGLImpl::SwapInterval(dpy, interval);
|
||||
}
|
||||
|
||||
MOBILEGL_EGL_API EGLBoolean eglSwapBuffers(EGLDisplay dpy, EGLSurface draw) {
|
||||
MGLOG_D("[MobileGL] eglSwapBuffers(dpy=%p, draw=%p)", dpy, draw);
|
||||
#ifdef TRACY_ENABLE
|
||||
FrameMark;
|
||||
#endif
|
||||
@@ -98,108 +121,140 @@ MOBILEGL_EGL_API EGLBoolean eglSwapBuffers(EGLDisplay dpy, EGLSurface draw) {
|
||||
}
|
||||
|
||||
MOBILEGL_EGL_API EGLSurface eglCreatePbufferSurface(EGLDisplay dpy, EGLConfig config, const EGLint* attrib_list) {
|
||||
MGLOG_D("[MobileGL] eglCreatePbufferSurface(dpy=%p, config=%p, attrib_list=%p)", dpy, config, attrib_list);
|
||||
return MobileGL::MG_Impl::EGLImpl::CreatePbufferSurface(dpy, config, attrib_list);
|
||||
}
|
||||
|
||||
MOBILEGL_EGL_API __eglMustCastToProperFunctionPointerType eglGetProcAddress(const char* name) {
|
||||
MGLOG_D("[MobileGL] eglGetProcAddress(name=%s)", name ? name : "null");
|
||||
return MobileGL::MG_Impl::EGLImpl::GetProcAddress(name);
|
||||
}
|
||||
|
||||
MOBILEGL_EGL_API EGLBoolean eglBindTexImage(EGLDisplay dpy, EGLSurface surface, EGLint buffer) {
|
||||
MGLOG_D("[MobileGL] eglBindTexImage(dpy=%p, surface=%p, buffer=%d)", dpy, surface, buffer);
|
||||
return MobileGL::MG_Impl::EGLImpl::BindTexImage(dpy, surface, buffer);
|
||||
}
|
||||
|
||||
MOBILEGL_EGL_API EGLBoolean eglReleaseTexImage(EGLDisplay dpy, EGLSurface surface, EGLint buffer) {
|
||||
MGLOG_D("[MobileGL] eglReleaseTexImage(dpy=%p, surface=%p, buffer=%d)", dpy, surface, buffer);
|
||||
return MobileGL::MG_Impl::EGLImpl::ReleaseTexImage(dpy, surface, buffer);
|
||||
}
|
||||
|
||||
MOBILEGL_EGL_API EGLBoolean eglCopyBuffers(EGLDisplay dpy, EGLSurface surface, EGLNativePixmapType target) {
|
||||
MGLOG_D("[MobileGL] eglCopyBuffers(dpy=%p, surface=%p, target=%p)", dpy, surface, target);
|
||||
return MobileGL::MG_Impl::EGLImpl::CopyBuffers(dpy, surface, target);
|
||||
}
|
||||
|
||||
MOBILEGL_EGL_API EGLSurface eglCreatePbufferFromClientBuffer(EGLDisplay dpy, EGLenum buftype,
|
||||
EGLClientBuffer buffer, EGLConfig config,
|
||||
const EGLint* attrib_list) {
|
||||
MOBILEGL_EGL_API EGLSurface eglCreatePbufferFromClientBuffer(EGLDisplay dpy, EGLenum buftype, EGLClientBuffer buffer,
|
||||
EGLConfig config, const EGLint* attrib_list) {
|
||||
MGLOG_D("[MobileGL] eglCreatePbufferFromClientBuffer(dpy=%p, buftype=%u, buffer=%p, config=%p, attrib_list=%p)",
|
||||
dpy, buftype, buffer, config, attrib_list);
|
||||
return MobileGL::MG_Impl::EGLImpl::CreatePbufferFromClientBuffer(dpy, buftype, buffer, config, attrib_list);
|
||||
}
|
||||
|
||||
MOBILEGL_EGL_API EGLSurface eglCreatePixmapSurface(EGLDisplay dpy, EGLConfig config, EGLNativePixmapType pixmap,
|
||||
const EGLint* attrib_list) {
|
||||
MGLOG_D("[MobileGL] eglCreatePixmapSurface(dpy=%p, config=%p, pixmap=%p, attrib_list=%p)", dpy, config, pixmap,
|
||||
attrib_list);
|
||||
return MobileGL::MG_Impl::EGLImpl::CreatePixmapSurface(dpy, config, pixmap, attrib_list);
|
||||
}
|
||||
|
||||
MOBILEGL_EGL_API EGLBoolean eglGetConfigs(EGLDisplay dpy, EGLConfig* configs, EGLint config_size, EGLint* num_config) {
|
||||
MGLOG_D("[MobileGL] eglGetConfigs(dpy=%p, configs=%p, config_size=%d, num_config=%p)", dpy, configs, config_size,
|
||||
num_config);
|
||||
return MobileGL::MG_Impl::EGLImpl::GetConfigs(dpy, configs, config_size, num_config);
|
||||
}
|
||||
|
||||
MOBILEGL_EGL_API EGLDisplay eglGetCurrentDisplay(void) {
|
||||
MGLOG_D("[MobileGL] eglGetCurrentDisplay()");
|
||||
return MobileGL::MG_Impl::EGLImpl::GetCurrentDisplay();
|
||||
}
|
||||
|
||||
MOBILEGL_EGL_API EGLenum eglQueryAPI(void) {
|
||||
MGLOG_D("[MobileGL] eglQueryAPI()");
|
||||
return MobileGL::MG_Impl::EGLImpl::QueryAPI();
|
||||
}
|
||||
|
||||
MOBILEGL_EGL_API EGLBoolean eglQueryContext(EGLDisplay dpy, EGLContext ctx, EGLint attribute, EGLint* value) {
|
||||
MGLOG_D("[MobileGL] eglQueryContext(dpy=%p, ctx=%p, attribute=%d, value=%p)", dpy, ctx, attribute, value);
|
||||
return MobileGL::MG_Impl::EGLImpl::QueryContext(dpy, ctx, attribute, value);
|
||||
}
|
||||
|
||||
MOBILEGL_EGL_API EGLBoolean eglSurfaceAttrib(EGLDisplay dpy, EGLSurface surface, EGLint attribute, EGLint value) {
|
||||
MGLOG_D("[MobileGL] eglSurfaceAttrib(dpy=%p, surface=%p, attribute=%d, value=%d)", dpy, surface, attribute, value);
|
||||
return MobileGL::MG_Impl::EGLImpl::SurfaceAttrib(dpy, surface, attribute, value);
|
||||
}
|
||||
|
||||
MOBILEGL_EGL_API EGLBoolean eglWaitClient(void) {
|
||||
MGLOG_D("[MobileGL] eglWaitClient()");
|
||||
return MobileGL::MG_Impl::EGLImpl::WaitClient();
|
||||
}
|
||||
|
||||
MOBILEGL_EGL_API EGLBoolean eglWaitGL(void) {
|
||||
MGLOG_D("[MobileGL] eglWaitGL()");
|
||||
return MobileGL::MG_Impl::EGLImpl::WaitGL();
|
||||
}
|
||||
|
||||
MOBILEGL_EGL_API EGLBoolean eglWaitNative(EGLint engine) {
|
||||
MGLOG_D("[MobileGL] eglWaitNative(engine=%d)", engine);
|
||||
return MobileGL::MG_Impl::EGLImpl::WaitNative(engine);
|
||||
}
|
||||
|
||||
MOBILEGL_EGL_API EGLSync eglCreateSync(EGLDisplay dpy, EGLenum type, const EGLAttrib* attrib_list) {
|
||||
MGLOG_D("[MobileGL] eglCreateSync(dpy=%p, type=%u, attrib_list=%p)", dpy, type, attrib_list);
|
||||
return MobileGL::MG_Impl::EGLImpl::CreateSync(dpy, type, attrib_list);
|
||||
}
|
||||
|
||||
MOBILEGL_EGL_API EGLBoolean eglDestroySync(EGLDisplay dpy, EGLSync sync) {
|
||||
MGLOG_D("[MobileGL] eglDestroySync(dpy=%p, sync=%p)", dpy, sync);
|
||||
return MobileGL::MG_Impl::EGLImpl::DestroySync(dpy, sync);
|
||||
}
|
||||
|
||||
MOBILEGL_EGL_API EGLint eglClientWaitSync(EGLDisplay dpy, EGLSync sync, EGLint flags, EGLTime timeout) {
|
||||
MGLOG_D("[MobileGL] eglClientWaitSync(dpy=%p, sync=%p, flags=%d, timeout=%llu)", dpy, sync, flags,
|
||||
static_cast<unsigned long long>(timeout));
|
||||
return MobileGL::MG_Impl::EGLImpl::ClientWaitSync(dpy, sync, flags, timeout);
|
||||
}
|
||||
|
||||
MOBILEGL_EGL_API EGLBoolean eglGetSyncAttrib(EGLDisplay dpy, EGLSync sync, EGLint attribute, EGLAttrib* value) {
|
||||
MGLOG_D("[MobileGL] eglGetSyncAttrib(dpy=%p, sync=%p, attribute=%d, value=%p)", dpy, sync, attribute, value);
|
||||
return MobileGL::MG_Impl::EGLImpl::GetSyncAttrib(dpy, sync, attribute, value);
|
||||
}
|
||||
|
||||
MOBILEGL_EGL_API EGLImage eglCreateImage(EGLDisplay dpy, EGLContext ctx, EGLenum target, EGLClientBuffer buffer,
|
||||
const EGLAttrib* attrib_list) {
|
||||
MGLOG_D("[MobileGL] eglCreateImage(dpy=%p, ctx=%p, target=%u, buffer=%p, attrib_list=%p)", dpy, ctx, target, buffer,
|
||||
attrib_list);
|
||||
return MobileGL::MG_Impl::EGLImpl::CreateImage(dpy, ctx, target, buffer, attrib_list);
|
||||
}
|
||||
|
||||
MOBILEGL_EGL_API EGLBoolean eglDestroyImage(EGLDisplay dpy, EGLImage image) {
|
||||
MGLOG_D("[MobileGL] eglDestroyImage(dpy=%p, image=%p)", dpy, image);
|
||||
return MobileGL::MG_Impl::EGLImpl::DestroyImage(dpy, image);
|
||||
}
|
||||
|
||||
MOBILEGL_EGL_API EGLDisplay eglGetPlatformDisplay(EGLenum platform, void* native_display,
|
||||
const EGLAttrib* attrib_list) {
|
||||
MGLOG_D("[MobileGL] eglGetPlatformDisplay(platform=%u, native_display=%p, attrib_list=%p)", platform,
|
||||
native_display, attrib_list);
|
||||
return MobileGL::MG_Impl::EGLImpl::GetPlatformDisplay(platform, native_display, attrib_list);
|
||||
}
|
||||
|
||||
MOBILEGL_EGL_API EGLSurface eglCreatePlatformWindowSurface(EGLDisplay dpy, EGLConfig config, void* native_window,
|
||||
const EGLAttrib* attrib_list) {
|
||||
MGLOG_D("[MobileGL] eglCreatePlatformWindowSurface(dpy=%p, config=%p, native_window=%p, attrib_list=%p)", dpy,
|
||||
config, native_window, attrib_list);
|
||||
return MobileGL::MG_Impl::EGLImpl::CreatePlatformWindowSurface(dpy, config, native_window, attrib_list);
|
||||
}
|
||||
|
||||
MOBILEGL_EGL_API EGLSurface eglCreatePlatformPixmapSurface(EGLDisplay dpy, EGLConfig config, void* native_pixmap,
|
||||
const EGLAttrib* attrib_list) {
|
||||
MGLOG_D("[MobileGL] eglCreatePlatformPixmapSurface(dpy=%p, config=%p, native_pixmap=%p, attrib_list=%p)", dpy,
|
||||
config, native_pixmap, attrib_list);
|
||||
return MobileGL::MG_Impl::EGLImpl::CreatePlatformPixmapSurface(dpy, config, native_pixmap, attrib_list);
|
||||
}
|
||||
|
||||
MOBILEGL_EGL_API EGLBoolean eglWaitSync(EGLDisplay dpy, EGLSync sync, EGLint flags) {
|
||||
MGLOG_D("[MobileGL] eglWaitSync(dpy=%p, sync=%p, flags=%d)", dpy, sync, flags);
|
||||
return MobileGL::MG_Impl::EGLImpl::WaitSync(dpy, sync, flags);
|
||||
}
|
||||
|
||||
@@ -1,195 +0,0 @@
|
||||
// MobileGL - MobileGL/MG_Impl/EGLImpl/Temporary/TemporaryEGLImpl.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 "TemporaryEGLImpl.h"
|
||||
#include <Config.h>
|
||||
|
||||
#if !(MOBILEGL_BACKEND == MOBILEGL_BACKEND_TYPE_DIRECT_GLES)
|
||||
namespace MobileGL {
|
||||
namespace MG_Impl::EGLImpl {
|
||||
// TODO: implement complete EGL functionality
|
||||
|
||||
EGLSurface CreateWindowSurface(EGLDisplay dpy, EGLConfig config, NativeWindowType window,
|
||||
const EGLint* attrib_list) {
|
||||
return (EGLSurface)1;
|
||||
}
|
||||
|
||||
EGLBoolean ChooseConfig(EGLDisplay dpy, const EGLint* attrib_list, EGLConfig* configs, EGLint config_size,
|
||||
EGLint* num_config) {
|
||||
*num_config = 1;
|
||||
return EGL_TRUE;
|
||||
}
|
||||
|
||||
EGLContext CreateContext(EGLDisplay dpy, EGLConfig config, EGLContext shareCtx, const EGLint* attrib_list) {
|
||||
return (EGLContext)1;
|
||||
}
|
||||
|
||||
EGLBoolean Initialize(EGLDisplay dpy, EGLint* major, EGLint* minor) {
|
||||
if (major) *major = 1;
|
||||
if (minor) *minor = 5;
|
||||
return EGL_TRUE;
|
||||
}
|
||||
|
||||
EGLDisplay GetDisplay(NativeDisplayType display) {
|
||||
return (EGLDisplay)1;
|
||||
}
|
||||
|
||||
EGLint GetError() {
|
||||
return EGL_SUCCESS;
|
||||
}
|
||||
|
||||
EGLBoolean MakeCurrent(EGLDisplay dpy, EGLSurface draw, EGLSurface read, EGLContext ctx) {
|
||||
return EGL_TRUE;
|
||||
}
|
||||
|
||||
EGLBoolean DestroyContext(EGLDisplay dpy, EGLContext ctx) {
|
||||
return EGL_TRUE;
|
||||
}
|
||||
|
||||
EGLBoolean DestroySurface(EGLDisplay dpy, EGLSurface surface) {
|
||||
return EGL_TRUE;
|
||||
}
|
||||
|
||||
EGLBoolean Terminate(EGLDisplay dpy) {
|
||||
return EGL_TRUE;
|
||||
}
|
||||
|
||||
EGLBoolean ReleaseThread(void) {
|
||||
return EGL_TRUE;
|
||||
}
|
||||
|
||||
EGLContext GetCurrentContext(void) {
|
||||
return (EGLContext)1;
|
||||
}
|
||||
|
||||
EGLBoolean GetConfigAttrib(EGLDisplay dpy, EGLConfig config, EGLint attribute, EGLint* value) {
|
||||
if (attribute == EGL_NATIVE_VISUAL_ID) {
|
||||
#if defined(ANDROID)
|
||||
*value = AHARDWAREBUFFER_FORMAT_R8G8B8A8_UNORM;
|
||||
return EGL_TRUE;
|
||||
#elif defined(__linux__)
|
||||
*value = 0;
|
||||
return EGL_TRUE;
|
||||
#elif defined(_WIN32)
|
||||
*value = 0;
|
||||
return EGL_TRUE;
|
||||
#else
|
||||
*value = 0;
|
||||
return EGL_FALSE;
|
||||
#endif
|
||||
}
|
||||
return EGL_TRUE;
|
||||
}
|
||||
|
||||
EGLBoolean BindAPI(EGLenum api) {
|
||||
return EGL_TRUE;
|
||||
}
|
||||
|
||||
EGLSurface GetCurrentSurface(EGLint readdraw) {
|
||||
return (EGLSurface)1;
|
||||
}
|
||||
|
||||
EGLBoolean QuerySurface(EGLDisplay display, EGLSurface surface, EGLint attribute, EGLint* value) {
|
||||
return EGL_TRUE;
|
||||
}
|
||||
|
||||
char const* QueryString(EGLDisplay display, EGLint name) {
|
||||
return "";
|
||||
}
|
||||
|
||||
EGLBoolean SwapInterval(EGLDisplay dpy, EGLint interval) {
|
||||
return EGL_TRUE;
|
||||
}
|
||||
|
||||
EGLBoolean SwapBuffers(EGLDisplay dpy, EGLSurface draw) {
|
||||
return EGL_TRUE;
|
||||
}
|
||||
|
||||
EGLSurface CreatePbufferSurface(EGLDisplay dpy, EGLConfig config, const EGLint* attrib_list) {
|
||||
return (EGLSurface)1;
|
||||
}
|
||||
|
||||
EGLBoolean BindTexImage(EGLDisplay dpy, EGLSurface surface, EGLint buffer) {
|
||||
return EGL_TRUE;
|
||||
}
|
||||
|
||||
EGLBoolean ReleaseTexImage(EGLDisplay dpy, EGLSurface surface, EGLint buffer) {
|
||||
return EGL_TRUE;
|
||||
}
|
||||
|
||||
EGLBoolean CopyBuffers(EGLDisplay dpy, EGLSurface surface, EGLNativePixmapType target) {
|
||||
return EGL_TRUE;
|
||||
}
|
||||
|
||||
EGLSurface CreatePbufferFromClientBuffer(EGLDisplay dpy, EGLenum buftype, EGLClientBuffer buffer,
|
||||
EGLConfig config, const EGLint* attrib_list) {
|
||||
return (EGLSurface)1;
|
||||
}
|
||||
|
||||
EGLSurface CreatePixmapSurface(EGLDisplay dpy, EGLConfig config, EGLNativePixmapType pixmap,
|
||||
const EGLint* attrib_list) {
|
||||
return (EGLSurface)1;
|
||||
}
|
||||
|
||||
EGLBoolean GetConfigs(EGLDisplay dpy, EGLConfig* configs, EGLint config_size, EGLint* num_config) {
|
||||
if (num_config) {
|
||||
*num_config = 1;
|
||||
}
|
||||
if (configs && config_size > 0) {
|
||||
configs[0] = (EGLConfig)1;
|
||||
}
|
||||
return EGL_TRUE;
|
||||
}
|
||||
|
||||
EGLDisplay GetCurrentDisplay(void) {
|
||||
return (EGLDisplay)1;
|
||||
}
|
||||
|
||||
EGLenum QueryAPI(void) {
|
||||
return EGL_OPENGL_API;
|
||||
}
|
||||
|
||||
EGLBoolean QueryContext(EGLDisplay dpy, EGLContext ctx, EGLint attribute, EGLint* value) {
|
||||
if (value) {
|
||||
*value = 0;
|
||||
}
|
||||
return EGL_TRUE;
|
||||
}
|
||||
|
||||
EGLBoolean SurfaceAttrib(EGLDisplay dpy, EGLSurface surface, EGLint attribute, EGLint value) {
|
||||
return EGL_TRUE;
|
||||
}
|
||||
|
||||
EGLBoolean WaitClient(void) {
|
||||
return EGL_TRUE;
|
||||
}
|
||||
|
||||
EGLBoolean WaitGL(void) {
|
||||
return EGL_TRUE;
|
||||
}
|
||||
|
||||
EGLBoolean WaitNative(EGLint engine) {
|
||||
return EGL_TRUE;
|
||||
}
|
||||
|
||||
__eglMustCastToProperFunctionPointerType GetProcAddress(const char* name) {
|
||||
MGLOG_D("eglGetProcAddress(%s)", name);
|
||||
#if !defined(WIN32) && !defined(__APPLE__)
|
||||
void* proc = dlsym(RTLD_DEFAULT, (const char*)name);
|
||||
#else
|
||||
void* proc = NULL;
|
||||
#endif
|
||||
if (!proc) {
|
||||
MGLOG_W("Failed to get function: %s", (const char*)name);
|
||||
return nullptr;
|
||||
}
|
||||
return (__eglMustCastToProperFunctionPointerType)proc;
|
||||
}
|
||||
} // namespace MG_Impl::EGLImpl
|
||||
} // namespace MobileGL
|
||||
#endif
|
||||
@@ -1,66 +0,0 @@
|
||||
// MobileGL - MobileGL/MG_Impl/EGLImpl/Temporary/TemporaryEGLImpl.h
|
||||
// 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
|
||||
|
||||
#pragma once
|
||||
#include <Includes.h>
|
||||
|
||||
namespace MobileGL {
|
||||
namespace MG_Impl::EGLImpl {
|
||||
EGLSurface CreateWindowSurface(EGLDisplay dpy, EGLConfig config, NativeWindowType window,
|
||||
const EGLint* attrib_list);
|
||||
EGLBoolean ChooseConfig(EGLDisplay dpy, const EGLint* attrib_list, EGLConfig* configs, EGLint config_size,
|
||||
EGLint* num_config);
|
||||
EGLContext CreateContext(EGLDisplay dpy, EGLConfig config, EGLContext shareCtx, const EGLint* attrib_list);
|
||||
EGLBoolean Initialize(EGLDisplay dpy, EGLint* major, EGLint* minor);
|
||||
EGLDisplay GetDisplay(NativeDisplayType display);
|
||||
EGLint GetError();
|
||||
EGLBoolean MakeCurrent(EGLDisplay dpy, EGLSurface draw, EGLSurface read, EGLContext ctx);
|
||||
EGLBoolean DestroyContext(EGLDisplay dpy, EGLContext ctx);
|
||||
EGLBoolean DestroySurface(EGLDisplay dpy, EGLSurface surface);
|
||||
EGLBoolean Terminate(EGLDisplay dpy);
|
||||
EGLBoolean ReleaseThread(void);
|
||||
EGLContext GetCurrentContext(void);
|
||||
EGLBoolean GetConfigAttrib(EGLDisplay dpy, EGLConfig config, EGLint attribute, EGLint* value);
|
||||
EGLBoolean BindAPI(EGLenum api);
|
||||
EGLSurface GetCurrentSurface(EGLint readdraw);
|
||||
EGLBoolean QuerySurface(EGLDisplay display, EGLSurface surface, EGLint attribute, EGLint* value);
|
||||
char const* QueryString(EGLDisplay display, EGLint name);
|
||||
EGLBoolean SwapInterval(EGLDisplay dpy, EGLint interval);
|
||||
EGLBoolean SwapBuffers(EGLDisplay dpy, EGLSurface draw);
|
||||
EGLSurface CreatePbufferSurface(EGLDisplay dpy, EGLConfig config, const EGLint* attrib_list);
|
||||
EGLBoolean BindTexImage(EGLDisplay dpy, EGLSurface surface, EGLint buffer);
|
||||
EGLBoolean ReleaseTexImage(EGLDisplay dpy, EGLSurface surface, EGLint buffer);
|
||||
EGLBoolean CopyBuffers(EGLDisplay dpy, EGLSurface surface, EGLNativePixmapType target);
|
||||
EGLSurface CreatePbufferFromClientBuffer(EGLDisplay dpy, EGLenum buftype, EGLClientBuffer buffer,
|
||||
EGLConfig config, const EGLint* attrib_list);
|
||||
EGLSurface CreatePixmapSurface(EGLDisplay dpy, EGLConfig config, EGLNativePixmapType pixmap,
|
||||
const EGLint* attrib_list);
|
||||
EGLBoolean GetConfigs(EGLDisplay dpy, EGLConfig* configs, EGLint config_size, EGLint* num_config);
|
||||
EGLDisplay GetCurrentDisplay(void);
|
||||
EGLenum QueryAPI(void);
|
||||
EGLBoolean QueryContext(EGLDisplay dpy, EGLContext ctx, EGLint attribute, EGLint* value);
|
||||
EGLBoolean SurfaceAttrib(EGLDisplay dpy, EGLSurface surface, EGLint attribute, EGLint value);
|
||||
EGLBoolean WaitClient(void);
|
||||
EGLBoolean WaitGL(void);
|
||||
EGLBoolean WaitNative(EGLint engine);
|
||||
__eglMustCastToProperFunctionPointerType GetProcAddress(const char* name);
|
||||
EGLSync CreateSync(EGLDisplay dpy, EGLenum type, const EGLAttrib* attrib_list);
|
||||
EGLBoolean DestroySync(EGLDisplay dpy, EGLSync sync);
|
||||
EGLint ClientWaitSync(EGLDisplay dpy, EGLSync sync, EGLint flags, EGLTime timeout);
|
||||
EGLBoolean GetSyncAttrib(EGLDisplay dpy, EGLSync sync, EGLint attribute, EGLAttrib* value);
|
||||
EGLImage CreateImage(EGLDisplay dpy, EGLContext ctx, EGLenum target, EGLClientBuffer buffer,
|
||||
const EGLAttrib* attrib_list);
|
||||
EGLBoolean DestroyImage(EGLDisplay dpy, EGLImage image);
|
||||
EGLDisplay GetPlatformDisplay(EGLenum platform, void* native_display, const EGLAttrib* attrib_list);
|
||||
EGLSurface CreatePlatformWindowSurface(EGLDisplay dpy, EGLConfig config, void* native_window,
|
||||
const EGLAttrib* attrib_list);
|
||||
EGLSurface CreatePlatformPixmapSurface(EGLDisplay dpy, EGLConfig config, void* native_pixmap,
|
||||
const EGLAttrib* attrib_list);
|
||||
EGLBoolean WaitSync(EGLDisplay dpy, EGLSync sync, EGLint flags);
|
||||
} // namespace MG_Impl::EGLImpl
|
||||
} // namespace MobileGL
|
||||
Reference in New Issue
Block a user