Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(66)

Unified Diff: remoting/client/jni/egl_thread_context.h

Issue 2175913002: [Remoting Android] Make EglThreadContext create OpenGL ES 3 context (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Reviewer's Feedback Created 4 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | remoting/client/jni/egl_thread_context.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: remoting/client/jni/egl_thread_context.h
diff --git a/remoting/client/jni/egl_thread_context.h b/remoting/client/jni/egl_thread_context.h
index f8f2b8e89cd3b862f49b8fc26024d13fe442f81d..aa5645cc293ad0f8f4872cb2948b9901dba7bf7c 100644
--- a/remoting/client/jni/egl_thread_context.h
+++ b/remoting/client/jni/egl_thread_context.h
@@ -12,22 +12,18 @@
namespace remoting {
-// Establishes an EGL-OpenGL|ES2 context on current thread. Must be constructed,
-// used, and deleted on single thread (i.e. the display thread). Each thread can
-// have no more than one EglThreadContext.
-//
-// An example use case:
-// class DisplayHandler {
-// void OnSurfaceCreated(ANativeWindow* surface) {
-// context_.BindToWindow(surface);
-// }
-// void OnSurfaceDestroyed() {
-// context_.BindToWindow(nullptr);
-// }
-// EglThreadContext context_;
-// };
+// Establishes an EGL-OpenGL|ES 2 (if 3 is not supported) or 3 (backward
+// compatible with 2) context on current thread. Must be constructed, used, and
+// deleted on single thread (i.e. the display thread). Each thread can have no
+// more than one EglThreadContext.
class EglThreadContext {
public:
+ enum class GlVersion {
+ UNKNOWN = 0,
+ ES_2 = 2,
+ ES_3 = 3
+ };
+
EglThreadContext();
~EglThreadContext();
@@ -36,19 +32,32 @@ class EglThreadContext {
// EGLNativeWindowType is platform specific. E.g. ANativeWindow* on Android.
void BindToWindow(EGLNativeWindowType window);
- // Returns true IFF the context is bound to a window (i.e. current surface is
+ // Returns true if the context is bound to a window (i.e. current surface is
// not NULL).
bool IsWindowBound() const;
- // Posts EGL surface buffer to the window being bound. Window must be bound
- // before calling this function.
- void SwapBuffers();
+ // Posts EGL surface buffer to the window being bound.
+ // Returns true if the buffer is successfully swapped.
+ bool SwapBuffers();
+
+ // Returns the current OpenGL ES client version of the EGL context.
+ GlVersion client_version() const {
+ return client_version_;
+ }
private:
+ // Creates an EGLContext with given |renderable_type| and |client_version|.
+ // |renderable_type| and |client_version| must match with each other.
+ // E.g. renderable_type = EGL_OPENGL_ES3_BIT,
+ // client_version = CLIENT_VERSION_ES_3.
+ bool CreateContextWithClientVersion(int renderable_type,
+ GlVersion client_version);
+
EGLDisplay display_ = EGL_NO_DISPLAY;
EGLConfig config_ = nullptr;
EGLSurface surface_ = EGL_NO_SURFACE;
EGLContext context_ = EGL_NO_CONTEXT;
+ GlVersion client_version_ = GlVersion::UNKNOWN;
base::ThreadChecker thread_checker_;
« no previous file with comments | « no previous file | remoting/client/jni/egl_thread_context.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698