• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 //
2 // Copyright 2016 The ANGLE Project Authors. All rights reserved.
3 // Use of this source code is governed by a BSD-style license that can be
4 // found in the LICENSE file.
5 //
6 
7 // Thread.h : Defines the Thread class which represents a global EGL thread.
8 
9 #ifndef LIBANGLE_THREAD_H_
10 #define LIBANGLE_THREAD_H_
11 
12 #include <EGL/egl.h>
13 
14 #include "libANGLE/Debug.h"
15 
16 namespace angle
17 {
18 extern bool gUseAndroidOpenGLTlsSlot;
19 }  // namespace angle
20 
21 namespace gl
22 {
23 class Context;
24 }  // namespace gl
25 
26 namespace egl
27 {
28 class Error;
29 class Debug;
30 class Display;
31 class Surface;
32 
33 class Thread : public LabeledObject
34 {
35   public:
36     Thread();
37 
38     void setLabel(EGLLabelKHR label) override;
39     EGLLabelKHR getLabel() const override;
40 
41     void setSuccess();
42 
43     void setError(EGLint error,
44                   const char *command,
45                   const LabeledObject *object,
46                   const char *message);
47 
48     // TODO: Remove egl::Error. http://anglebug.com/3041
49     void setError(const Error &error, const char *command, const LabeledObject *object);
50     EGLint getError() const;
51 
52     void setAPI(EGLenum api);
53     EGLenum getAPI() const;
54 
55     void setCurrent(gl::Context *context);
56     Surface *getCurrentDrawSurface() const;
57     Surface *getCurrentReadSurface() const;
58     gl::Context *getContext() const;
59     Display *getDisplay() const;
60 
61   private:
62     EGLLabelKHR mLabel;
63     EGLint mError;
64     EGLenum mAPI;
65     gl::Context *mContext;
66 };
67 
68 void EnsureDebugAllocated();
69 void DeallocateDebug();
70 Debug *GetDebug();
71 
72 }  // namespace egl
73 
74 #endif  // LIBANGLE_THREAD_H_
75