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

Side by Side Diff: gpu/gles2_conform_support/egl/context.h

Issue 1878133003: Revert of command_buffer_gles2: Implement EGL default Display as a global object (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@command_buffer_gles2-multiple-contexts
Patch Set: Created 4 years, 8 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 unified diff | Download patch
« no previous file with comments | « gpu/gles2_conform_support/egl/config.cc ('k') | gpu/gles2_conform_support/egl/context.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #ifndef GPU_GLES2_CONFORM_TEST_CONTEXT_H_
6 #define GPU_GLES2_CONFORM_TEST_CONTEXT_H_
7
8 #include "base/macros.h"
9 #include "base/memory/ref_counted.h"
10 #include "gpu/command_buffer/client/gles2_cmd_helper.h"
11 #include "gpu/command_buffer/client/gpu_control.h"
12 #include "gpu/command_buffer/service/command_buffer_service.h"
13 #include "gpu/command_buffer/service/command_executor.h"
14 #include "gpu/command_buffer/service/gles2_cmd_decoder.h"
15 #include "gpu/command_buffer/service/gpu_preferences.h"
16 #include "ui/gfx/native_widget_types.h"
17 #include "ui/gl/gl_context.h"
18 #include "ui/gl/gl_context.h"
19 #include "ui/gl/gl_surface.h"
20 #include "ui/gl/gl_surface.h"
21 #include <EGL/egl.h>
22
23 namespace gpu {
24 class TransferBuffer;
25 class TransferBufferManagerInterface;
26
27 namespace gles2 {
28 class GLES2CmdHelper;
29 class GLES2Interface;
30 } // namespace gles2
31 } // namespace gpu
32
33 namespace egl {
34 class Display;
35 class Surface;
36 class Config;
37
38 class Context : public base::RefCountedThreadSafe<Context>,
39 private gpu::GpuControl {
40 public:
41 Context(Display* display, const Config* config);
42 bool is_current_in_some_thread() const { return is_current_in_some_thread_; }
43 void set_is_current_in_some_thread(bool flag) {
44 is_current_in_some_thread_ = flag;
45 }
46 void MarkDestroyed();
47 void FlushAndSwapBuffers(gfx::GLSurface* current_surface);
48
49 static bool MakeCurrent(Context* current_context,
50 gfx::GLSurface* current_surface,
51 Context* new_context,
52 gfx::GLSurface* new_surface);
53
54 static bool ValidateAttributeList(const EGLint* attrib_list);
55
56 // GpuControl implementation.
57 gpu::Capabilities GetCapabilities() override;
58 int32_t CreateImage(ClientBuffer buffer,
59 size_t width,
60 size_t height,
61 unsigned internalformat) override;
62 void DestroyImage(int32_t id) override;
63 int32_t CreateGpuMemoryBufferImage(size_t width,
64 size_t height,
65 unsigned internalformat,
66 unsigned usage) override;
67 void SignalQuery(uint32_t query, const base::Closure& callback) override;
68 void SetLock(base::Lock*) override;
69 bool IsGpuChannelLost() override;
70 void EnsureWorkVisible() override;
71 gpu::CommandBufferNamespace GetNamespaceID() const override;
72 gpu::CommandBufferId GetCommandBufferID() const override;
73 int32_t GetExtraCommandBufferData() const override;
74 uint64_t GenerateFenceSyncRelease() override;
75 bool IsFenceSyncRelease(uint64_t release) override;
76 bool IsFenceSyncFlushed(uint64_t release) override;
77 bool IsFenceSyncFlushReceived(uint64_t release) override;
78 void SignalSyncToken(const gpu::SyncToken& sync_token,
79 const base::Closure& callback) override;
80 bool CanWaitUnverifiedSyncToken(const gpu::SyncToken* sync_token) override;
81
82 // Called by ThreadState to set the needed global variables when this context
83 // is current.
84 void ApplyCurrentContext(gfx::GLSurface* current_surface);
85 static void ApplyContextReleased();
86
87 private:
88 friend class base::RefCountedThreadSafe<Context>;
89 ~Context() override;
90 bool CreateService(gfx::GLSurface* gl_surface);
91 void DestroyService();
92 // Returns true if the object has GL service, either a working one or one
93 // that has lost its GL context.
94 bool HasService() const;
95 void MarkServiceContextLost();
96 bool WasServiceContextLost() const;
97 bool IsCompatibleSurface(gfx::GLSurface* gl_surface);
98 bool Flush(gfx::GLSurface* gl_surface);
99
100 Display* display_;
101 const Config* config_;
102 bool is_current_in_some_thread_;
103 bool is_destroyed_;
104 gpu::GpuPreferences gpu_preferences_;
105 scoped_ptr<gpu::CommandBufferService> command_buffer_;
106 scoped_ptr<gpu::gles2::GLES2CmdHelper> gles2_cmd_helper_;
107 scoped_ptr<gpu::gles2::GLES2Decoder> decoder_;
108 scoped_ptr<gpu::CommandExecutor> command_executor_;
109 scoped_ptr<gpu::TransferBuffer> transfer_buffer_;
110
111 scoped_refptr<gfx::GLContext> gl_context_;
112
113 scoped_ptr<gpu::gles2::GLES2Interface> client_gl_context_;
114 DISALLOW_COPY_AND_ASSIGN(Context);
115 };
116
117 } // namespace egl
118
119 #endif // GPU_GLES2_CONFORM_TEST_CONTEXT_H_
OLDNEW
« no previous file with comments | « gpu/gles2_conform_support/egl/config.cc ('k') | gpu/gles2_conform_support/egl/context.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698