Hash :
043fcf18
Author :
Date :
2021-01-07T13:23:57
Support create ANGLE EGLContext from an external EGLContext For Android WebView, Android creates an EGLContext, EGLSurface and FBO, and makeCurrent on them, and then calls WebView draw function to draw the WebView content on the current EGLSurface or binded FBO. So to use ANGLE in WebView, this CL adds a way to create ANGLE EGLContext from an external EGLContext, and save and restore GL state in eglMakeCurrent(). Bug: angleproject:5509 Change-Id: I874986813117f125e23e975ea1adc51ac5b3a631 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2615239 Commit-Queue: Peng Huang <penghuang@chromium.org> Reviewed-by: Geoff Lang <geofflang@chromium.org> Reviewed-by: Jonah Ryan-Davis <jonahr@google.com>
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42
//
// Copyright 2018 The ANGLE Project Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
//
// RendererEGL.h: Renderer class for GL on Android/ChromeOS. Owns an EGL context object.
#ifndef LIBANGLE_RENDERER_GL_EGL_RENDEREREGL_H_
#define LIBANGLE_RENDERER_GL_EGL_RENDEREREGL_H_
#include "libANGLE/renderer/gl/RendererGL.h"
#include "libANGLE/renderer/gl/egl/egl_utils.h"
namespace rx
{
class DisplayEGL;
class RendererEGL : public RendererGL
{
public:
RendererEGL(std::unique_ptr<FunctionsGL> functionsGL,
const egl::AttributeMap &attribMap,
DisplayEGL *display,
EGLContext context,
const native_egl::AttributeVector attribs,
bool isExternalContext);
~RendererEGL() override;
EGLContext getContext() const;
WorkerContext *createWorkerContext(std::string *infoLog) override;
private:
DisplayEGL *mDisplay;
EGLContext mContext;
const native_egl::AttributeVector mAttribs;
const bool mIsExternalContext;
};
} // namespace rx
#endif // LIBANGLE_RENDERER_GL_EGL_RENDEREREGL_H_