mirror of
https://github.com/MobileGL-Dev/MobileGL
synced 2026-09-08 12:18:30 +09:00
[Feat] (MG_Impl/EGL): Implement a simplified egl temporarily.
This commit is contained in:
+31
-27
@@ -15,43 +15,47 @@ set(PROFILING OFF)
|
||||
find_library(GLSLANG_LIB glslang PATHS ${CMAKE_SOURCE_DIR}/libraries/arm64-v8a/)
|
||||
|
||||
add_library(${CMAKE_PROJECT_NAME} SHARED
|
||||
MobileGL/Init.cpp
|
||||
MobileGL/Init.cpp
|
||||
|
||||
MobileGL/MG_Util/Debug/Log.cpp
|
||||
MobileGL/MG_Util/Debug/Log.cpp
|
||||
|
||||
MobileGL/MG_Impl/GLXImpl/Exporting/Definitions.cpp
|
||||
MobileGL/MG_Impl/GLXImpl/LookUp/LookUp.cpp)
|
||||
MobileGL/MG_Impl/GLXImpl/Exporting/Definitions.cpp
|
||||
MobileGL/MG_Impl/GLXImpl/LookUp/LookUp.cpp
|
||||
|
||||
MobileGL/MG_Impl/EGLImpl/Exporting/Definitions.cpp
|
||||
MobileGL/MG_Impl/EGLImpl/Temporary/TemporaryEGLImpl.cpp
|
||||
)
|
||||
|
||||
target_link_libraries(${CMAKE_PROJECT_NAME} PRIVATE
|
||||
${CMAKE_SOURCE_DIR}/library/arm64-v8a/libglslang.a
|
||||
${CMAKE_SOURCE_DIR}/library/arm64-v8a/libspirv-cross-c-shared.so
|
||||
${CMAKE_SOURCE_DIR}/library/arm64-v8a/libGenericCodeGen.a
|
||||
${CMAKE_SOURCE_DIR}/library/arm64-v8a/libglslang-default-resource-limits.a
|
||||
${CMAKE_SOURCE_DIR}/library/arm64-v8a/libMachineIndependent.a
|
||||
${CMAKE_SOURCE_DIR}/library/arm64-v8a/libOSDependent.a
|
||||
${CMAKE_SOURCE_DIR}/library/arm64-v8a/libSPIRV-Tools-diff.a
|
||||
${CMAKE_SOURCE_DIR}/library/arm64-v8a/libSPIRV-Tools-link.a
|
||||
${CMAKE_SOURCE_DIR}/library/arm64-v8a/libSPIRV-Tools-lint.a
|
||||
${CMAKE_SOURCE_DIR}/library/arm64-v8a/libSPIRV-Tools-opt.a
|
||||
${CMAKE_SOURCE_DIR}/library/arm64-v8a/libSPIRV-Tools-reduce.a
|
||||
${CMAKE_SOURCE_DIR}/library/arm64-v8a/libSPIRV-Tools.a
|
||||
${CMAKE_SOURCE_DIR}/library/arm64-v8a/libSPIRV.a
|
||||
${CMAKE_SOURCE_DIR}/library/arm64-v8a/libSPVRemapper.a
|
||||
android
|
||||
log
|
||||
EGL
|
||||
vulkan
|
||||
${CMAKE_SOURCE_DIR}/library/arm64-v8a/libglslang.a
|
||||
${CMAKE_SOURCE_DIR}/library/arm64-v8a/libspirv-cross-c-shared.so
|
||||
${CMAKE_SOURCE_DIR}/library/arm64-v8a/libGenericCodeGen.a
|
||||
${CMAKE_SOURCE_DIR}/library/arm64-v8a/libglslang-default-resource-limits.a
|
||||
${CMAKE_SOURCE_DIR}/library/arm64-v8a/libMachineIndependent.a
|
||||
${CMAKE_SOURCE_DIR}/library/arm64-v8a/libOSDependent.a
|
||||
${CMAKE_SOURCE_DIR}/library/arm64-v8a/libSPIRV-Tools-diff.a
|
||||
${CMAKE_SOURCE_DIR}/library/arm64-v8a/libSPIRV-Tools-link.a
|
||||
${CMAKE_SOURCE_DIR}/library/arm64-v8a/libSPIRV-Tools-lint.a
|
||||
${CMAKE_SOURCE_DIR}/library/arm64-v8a/libSPIRV-Tools-opt.a
|
||||
${CMAKE_SOURCE_DIR}/library/arm64-v8a/libSPIRV-Tools-reduce.a
|
||||
${CMAKE_SOURCE_DIR}/library/arm64-v8a/libSPIRV-Tools.a
|
||||
${CMAKE_SOURCE_DIR}/library/arm64-v8a/libSPIRV.a
|
||||
${CMAKE_SOURCE_DIR}/library/arm64-v8a/libSPVRemapper.a
|
||||
android
|
||||
log
|
||||
EGL
|
||||
vulkan
|
||||
)
|
||||
|
||||
# add_subdirectory(3rdparty/DiligentCore)
|
||||
|
||||
target_include_directories(MobileGL PUBLIC
|
||||
${CMAKE_SOURCE_DIR}/include
|
||||
${CMAKE_SOURCE_DIR}/include
|
||||
)
|
||||
|
||||
target_link_libraries(MobileGL
|
||||
PRIVATE
|
||||
# Diligent-Common
|
||||
# Diligent-GraphicsEngineOpenGL-shared
|
||||
# Diligent-GraphicsEngineVk-shared
|
||||
PRIVATE
|
||||
# Diligent-Common
|
||||
# Diligent-GraphicsEngineOpenGL-shared
|
||||
# Diligent-GraphicsEngineVk-shared
|
||||
)
|
||||
+2
-1
@@ -69,4 +69,5 @@
|
||||
|
||||
#include "MG_Util/Debug/Log.h"
|
||||
#include "Config.h"
|
||||
#include "MG_Impl/GLXImpl/LookUp/LookUp.h"
|
||||
#include "MG_Impl/GLXImpl/LookUp/LookUp.h"
|
||||
#include "MG_Impl/EGLImpl/Temporary/TemporaryEGLImpl.h"
|
||||
@@ -0,0 +1,85 @@
|
||||
#include "../../../Includes.h"
|
||||
|
||||
MOBILEGL_EGL_API EGLSurface eglCreateWindowSurface(EGLDisplay dpy, EGLConfig config, NativeWindowType window,
|
||||
const EGLint* 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) {
|
||||
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) {
|
||||
return MobileGL::MG_Impl::EGLImpl::CreateContext(dpy, config, shareCtx, attrib_list);
|
||||
}
|
||||
|
||||
MOBILEGL_EGL_API EGLBoolean eglInitialize(EGLDisplay dpy, EGLint* major, EGLint* minor) {
|
||||
return MobileGL::MG_Impl::EGLImpl::Initialize(dpy, major, minor);
|
||||
}
|
||||
|
||||
MOBILEGL_EGL_API EGLDisplay eglGetDisplay(NativeDisplayType display) {
|
||||
return MobileGL::MG_Impl::EGLImpl::GetDisplay(display);
|
||||
}
|
||||
|
||||
MOBILEGL_EGL_API EGLint eglGetError() {
|
||||
return MobileGL::MG_Impl::EGLImpl::GetError();
|
||||
}
|
||||
|
||||
MOBILEGL_EGL_API EGLBoolean eglMakeCurrent(EGLDisplay dpy, EGLSurface draw, EGLSurface read, EGLContext ctx) {
|
||||
return MobileGL::MG_Impl::EGLImpl::MakeCurrent(dpy, draw, read, ctx);
|
||||
}
|
||||
|
||||
MOBILEGL_EGL_API EGLBoolean eglDestroyContext(EGLDisplay dpy, EGLContext ctx) {
|
||||
return MobileGL::MG_Impl::EGLImpl::DestroyContext(dpy, ctx);
|
||||
}
|
||||
|
||||
MOBILEGL_EGL_API EGLBoolean eglDestroySurface(EGLDisplay dpy, EGLSurface surface) {
|
||||
return MobileGL::MG_Impl::EGLImpl::DestroySurface(dpy, surface);
|
||||
}
|
||||
|
||||
MOBILEGL_EGL_API EGLBoolean eglTerminate(EGLDisplay dpy) {
|
||||
return MobileGL::MG_Impl::EGLImpl::Terminate(dpy);
|
||||
}
|
||||
|
||||
MOBILEGL_EGL_API EGLBoolean eglReleaseThread(void) {
|
||||
return MobileGL::MG_Impl::EGLImpl::ReleaseThread();
|
||||
}
|
||||
|
||||
MOBILEGL_EGL_API EGLContext eglGetCurrentContext(void) {
|
||||
return MobileGL::MG_Impl::EGLImpl::GetCurrentContext();
|
||||
}
|
||||
|
||||
MOBILEGL_EGL_API EGLBoolean eglGetConfigAttrib(EGLDisplay dpy, EGLConfig config, EGLint attribute, EGLint* value) {
|
||||
return MobileGL::MG_Impl::EGLImpl::GetConfigAttrib(dpy, config, attribute, value);
|
||||
}
|
||||
|
||||
MOBILEGL_EGL_API EGLBoolean eglBindAPI(EGLenum api) {
|
||||
return MobileGL::MG_Impl::EGLImpl::BindAPI(api);
|
||||
}
|
||||
|
||||
MOBILEGL_EGL_API EGLSurface eglGetCurrentSurface(EGLint readdraw) {
|
||||
return MobileGL::MG_Impl::EGLImpl::GetCurrentSurface(readdraw);
|
||||
}
|
||||
|
||||
MOBILEGL_EGL_API EGLBoolean eglQuerySurface(EGLDisplay display, EGLSurface surface, EGLint attribute, EGLint* value) {
|
||||
return MobileGL::MG_Impl::EGLImpl::QuerySurface(display, surface, attribute, value);
|
||||
}
|
||||
|
||||
MOBILEGL_EGL_API EGLBoolean eglSwapInterval(EGLDisplay dpy, EGLint interval) {
|
||||
return MobileGL::MG_Impl::EGLImpl::SwapInterval(dpy, interval);
|
||||
}
|
||||
|
||||
MOBILEGL_EGL_API EGLBoolean eglSwapBuffers(EGLDisplay dpy, EGLSurface draw) {
|
||||
return MobileGL::MG_Impl::EGLImpl::SwapBuffers(dpy, draw);
|
||||
}
|
||||
|
||||
MOBILEGL_EGL_API EGLSurface eglCreatePbufferSurface(EGLDisplay dpy, EGLConfig config, const EGLint* attrib_list) {
|
||||
return MobileGL::MG_Impl::EGLImpl::CreatePbufferSurface(dpy, config, attrib_list);
|
||||
}
|
||||
|
||||
MOBILEGL_EGL_API __eglMustCastToProperFunctionPointerType eglGetProcAddress(const char* name) {
|
||||
return MobileGL::MG_Impl::EGLImpl::GetProcAddress(name);
|
||||
}
|
||||
|
||||
@@ -0,0 +1,101 @@
|
||||
#include "../../../Includes.h"
|
||||
|
||||
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)
|
||||
*value = AHARDWAREBUFFER_FORMAT_R8G8B8A8_UNORM;
|
||||
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;
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
__eglMustCastToProperFunctionPointerType GetProcAddress(const char* name) {
|
||||
MGLOG_D("eglGetProcAddress(%s)", name);
|
||||
void* proc = dlsym(RTLD_DEFAULT, (const char*)name);
|
||||
if (!proc) {
|
||||
MGLOG_W("Failed to get function: %s", (const char*)name);
|
||||
return nullptr;
|
||||
}
|
||||
return (__eglMustCastToProperFunctionPointerType)proc;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
#pragma once
|
||||
|
||||
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);
|
||||
EGLBoolean SwapInterval(EGLDisplay dpy, EGLint interval);
|
||||
EGLBoolean SwapBuffers(EGLDisplay dpy, EGLSurface draw);
|
||||
EGLSurface CreatePbufferSurface(EGLDisplay dpy, EGLConfig config, const EGLint* attrib_list);
|
||||
__eglMustCastToProperFunctionPointerType GetProcAddress(const char* name);
|
||||
}
|
||||
}
|
||||
@@ -1,6 +1,8 @@
|
||||
#include "../../../Includes.h"
|
||||
|
||||
namespace MG_Impl::GLXImpl {
|
||||
// TODO: Implement complete glx functionality
|
||||
|
||||
void* GetProcAddress(const char* name) {
|
||||
MGLOG_D("glXGetProcAddress(\"%s\")", name);
|
||||
void* proc = dlsym(RTLD_DEFAULT, (const char*)name);
|
||||
|
||||
Reference in New Issue
Block a user