mirror of
https://github.com/godotengine/godot-angle-static.git
synced 2026-01-03 14:09:33 +03:00
Add support for EGL_PLATFORM_ANGLE_EGL_HANDLE_ANGLE
To support ANGLE for Android need a way to tell ANGLE what library to call when using GL backend. Bug: angleproject:2418 Test: test-opengl-gl2_copyTexImage Change-Id: Ie00251b0672a036db4720e1e5b269f66a30a03da Reviewed-on: https://chromium-review.googlesource.com/1066822 Commit-Queue: Courtney Goeltzenleuchter <courtneygo@google.com> Reviewed-by: Frank Henigman <fjhenigman@chromium.org> Reviewed-by: Yuly Novikov <ynovikov@chromium.org> Reviewed-by: Geoff Lang <geofflang@chromium.org>
This commit is contained in:
committed by
Commit Bot
parent
c16516188d
commit
390900a04b
@@ -10,6 +10,7 @@ Contributors
|
||||
|
||||
Shannon Woods, Google
|
||||
Geoff Lang, Google
|
||||
Courtney Goeltzenleuchter, Google
|
||||
|
||||
Contacts
|
||||
|
||||
@@ -21,7 +22,7 @@ Status
|
||||
|
||||
Version
|
||||
|
||||
Version 3, 2014-11-26
|
||||
Version 4, 2018-05-17
|
||||
|
||||
Number
|
||||
|
||||
@@ -37,7 +38,9 @@ Dependencies
|
||||
|
||||
Overview
|
||||
|
||||
This extension enables selection of OpenGL display types.
|
||||
This extension enables selection of OpenGL display types and,
|
||||
for OpenGL ES display types, allows the application to pass
|
||||
in a handle to the EGL library to use.
|
||||
|
||||
New Types
|
||||
|
||||
@@ -54,6 +57,10 @@ New Tokens
|
||||
EGL_PLATFORM_ANGLE_TYPE_OPENGL_ANGLE 0x320D
|
||||
EGL_PLATFORM_ANGLE_TYPE_OPENGLES_ANGLE 0x320E
|
||||
|
||||
Accepted as an attribute name in the <attrib_list> argument of
|
||||
eglGetPlatformDisplayEXT:
|
||||
EGL_PLATFORM_ANGLE_EGL_HANDLE_ANGLE 0x3480
|
||||
|
||||
Additions to the EGL Specification
|
||||
|
||||
None.
|
||||
@@ -69,6 +76,13 @@ New Behavior
|
||||
API, EGL_PLATFORM_ANGLE_MAX_VERSION_MAJOR_ANGLE and
|
||||
EGL_PLATFORM_ANGLE_MAX_VERSION_MINOR_ANGLE can be used.
|
||||
|
||||
To pass in a handle to the system EGL library, use the attribute
|
||||
EGL_PLATFORM_ANGLE_EGL_HANDLE_ANGLE. If EGL_PLATFORM_ANGLE_TYPE_ANGLE
|
||||
is not equal to EGL_PLATFORM_ANGLE_TYPE_OPENGLES_ANGLE, an
|
||||
EGL_BAD_ATTRIBUTE is generated. If the handle provided with
|
||||
EGL_PLATFORM_ANGLE_EGL_HANDLE_ANGLE is not a valid EGL handle,
|
||||
behaviour is undefined.
|
||||
|
||||
Issues
|
||||
|
||||
None
|
||||
@@ -82,3 +96,5 @@ Revision History
|
||||
EGL_ANGLE_platform_angle spec to EGL_ANGLE_platform_angle_opengl.
|
||||
Version 3, 2014-11-26 (Geoff Lang)
|
||||
- Updated enum values.
|
||||
Version 4, 2018-05-17 (Courtney Goeltzenleuchter)
|
||||
- Add attribute for specifying underlying EGL library.
|
||||
|
||||
@@ -69,6 +69,7 @@
|
||||
#define EGL_ANGLE_platform_angle_opengl 1
|
||||
#define EGL_PLATFORM_ANGLE_TYPE_OPENGL_ANGLE 0x320D
|
||||
#define EGL_PLATFORM_ANGLE_TYPE_OPENGLES_ANGLE 0x320E
|
||||
#define EGL_PLATFORM_ANGLE_EGL_HANDLE_ANGLE 0x3480
|
||||
#endif /* EGL_ANGLE_platform_angle_opengl */
|
||||
|
||||
#ifndef EGL_ANGLE_platform_angle_null
|
||||
|
||||
@@ -32,8 +32,18 @@ FunctionsEGLDL::~FunctionsEGLDL()
|
||||
{
|
||||
}
|
||||
|
||||
egl::Error FunctionsEGLDL::initialize(EGLNativeDisplayType nativeDisplay, const char *libName)
|
||||
egl::Error FunctionsEGLDL::initialize(EGLNativeDisplayType nativeDisplay,
|
||||
const char *libName,
|
||||
void *eglHandle)
|
||||
{
|
||||
|
||||
if (eglHandle)
|
||||
{
|
||||
// If the handle is provided, use it.
|
||||
// Caller has already dlopened the vendor library.
|
||||
nativeEGLHandle = eglHandle;
|
||||
}
|
||||
|
||||
if (!nativeEGLHandle)
|
||||
{
|
||||
nativeEGLHandle = dlopen(libName, RTLD_NOW);
|
||||
|
||||
@@ -20,7 +20,7 @@ class FunctionsEGLDL : public FunctionsEGL
|
||||
FunctionsEGLDL();
|
||||
~FunctionsEGLDL() override;
|
||||
|
||||
egl::Error initialize(EGLNativeDisplayType nativeDisplay, const char *libName);
|
||||
egl::Error initialize(EGLNativeDisplayType nativeDisplay, const char *libName, void *eglHandle);
|
||||
void *getProcAddress(const char *name) const override;
|
||||
|
||||
private:
|
||||
|
||||
@@ -11,11 +11,11 @@
|
||||
#include "common/debug.h"
|
||||
#include "libANGLE/Display.h"
|
||||
#include "libANGLE/Surface.h"
|
||||
#include "libANGLE/renderer/gl/renderergl_utils.h"
|
||||
#include "libANGLE/renderer/gl/egl/android/DisplayAndroid.h"
|
||||
#include "libANGLE/renderer/gl/egl/FunctionsEGLDL.h"
|
||||
#include "libANGLE/renderer/gl/egl/PbufferSurfaceEGL.h"
|
||||
#include "libANGLE/renderer/gl/egl/WindowSurfaceEGL.h"
|
||||
#include "libANGLE/renderer/gl/egl/android/DisplayAndroid.h"
|
||||
#include "libANGLE/renderer/gl/renderergl_utils.h"
|
||||
|
||||
namespace
|
||||
{
|
||||
@@ -45,7 +45,9 @@ egl::Error DisplayAndroid::initialize(egl::Display *display)
|
||||
{
|
||||
FunctionsEGLDL *egl = new FunctionsEGLDL();
|
||||
mEGL = egl;
|
||||
ANGLE_TRY(egl->initialize(display->getNativeDisplayId(), GetEGLPath()));
|
||||
void *eglHandle = reinterpret_cast<void *>(display->getAttributeMap().get(
|
||||
EGL_PLATFORM_ANGLE_EGL_HANDLE_ANGLE, 0));
|
||||
ANGLE_TRY(egl->initialize(display->getNativeDisplayId(), GetEGLPath(), eglHandle));
|
||||
|
||||
gl::Version eglVersion(mEGL->majorVersion, mEGL->minorVersion);
|
||||
ASSERT(eglVersion >= gl::Version(1, 4));
|
||||
|
||||
@@ -459,7 +459,7 @@ egl::Error DisplayOzone::initialize(egl::Display *display)
|
||||
// with a .1 suffix) while Angle only installs libEGL.so.
|
||||
FunctionsEGLDL *egl = new FunctionsEGLDL();
|
||||
mEGL = egl;
|
||||
ANGLE_TRY(egl->initialize(display->getNativeDisplayId(), "libEGL.so.1"));
|
||||
ANGLE_TRY(egl->initialize(display->getNativeDisplayId(), "libEGL.so.1", nullptr));
|
||||
|
||||
const char *necessaryExtensions[] = {
|
||||
"EGL_KHR_image_base", "EGL_EXT_image_dma_buf_import", "EGL_KHR_surfaceless_context",
|
||||
|
||||
@@ -304,6 +304,7 @@ Error ValidateGetPlatformDisplayCommon(EGLenum platform,
|
||||
Optional<EGLAttrib> majorVersion;
|
||||
Optional<EGLAttrib> minorVersion;
|
||||
Optional<EGLAttrib> deviceType;
|
||||
Optional<EGLAttrib> eglHandle;
|
||||
|
||||
for (const auto &curAttrib : attribMap)
|
||||
{
|
||||
@@ -400,6 +401,13 @@ Error ValidateGetPlatformDisplayCommon(EGLenum platform,
|
||||
}
|
||||
break;
|
||||
|
||||
case EGL_PLATFORM_ANGLE_EGL_HANDLE_ANGLE:
|
||||
if (value != EGL_DONT_CARE)
|
||||
{
|
||||
eglHandle = value;
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
@@ -460,6 +468,13 @@ Error ValidateGetPlatformDisplayCommon(EGLenum platform,
|
||||
"only supports Vulkan 1.0.";
|
||||
}
|
||||
}
|
||||
|
||||
if (eglHandle.valid() && platformType != EGL_PLATFORM_ANGLE_TYPE_OPENGLES_ANGLE &&
|
||||
platformType != EGL_PLATFORM_ANGLE_TYPE_DEFAULT_ANGLE)
|
||||
{
|
||||
return EglBadAttribute() << "EGL_PLATFORM_ANGLE_EGL_HANDLE_ANGLE requires a "
|
||||
"device type of EGL_PLATFORM_ANGLE_TYPE_OPENGLES_ANGLE.";
|
||||
}
|
||||
}
|
||||
else if (platform == EGL_PLATFORM_DEVICE_EXT)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user