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

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

Issue 1895153002: 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 void SetGpuControlClient(gpu::GpuControlClient*) override;
58 gpu::Capabilities GetCapabilities() override;
59 int32_t CreateImage(ClientBuffer buffer,
60 size_t width,
61 size_t height,
62 unsigned internalformat) override;
63 void DestroyImage(int32_t id) override;
64 int32_t CreateGpuMemoryBufferImage(size_t width,
65 size_t height,
66 unsigned internalformat,
67 unsigned usage) override;
68 void SignalQuery(uint32_t query, const base::Closure& callback) override;
69 void SetLock(base::Lock*) override;
70 bool IsGpuChannelLost() override;
71 void EnsureWorkVisible() override;
72 gpu::CommandBufferNamespace GetNamespaceID() const override;
73 gpu::CommandBufferId GetCommandBufferID() const override;
74 int32_t GetExtraCommandBufferData() const override;
75 uint64_t GenerateFenceSyncRelease() override;
76 bool IsFenceSyncRelease(uint64_t release) override;
77 bool IsFenceSyncFlushed(uint64_t release) override;
78 bool IsFenceSyncFlushReceived(uint64_t release) override;
79 void SignalSyncToken(const gpu::SyncToken& sync_token,
80 const base::Closure& callback) override;
81 bool CanWaitUnverifiedSyncToken(const gpu::SyncToken* sync_token) override;
82
83 // Called by ThreadState to set the needed global variables when this context
84 // is current.
85 void ApplyCurrentContext(gfx::GLSurface* current_surface);
86 static void ApplyContextReleased();
87
88 private:
89 friend class base::RefCountedThreadSafe<Context>;
90 ~Context() override;
91 bool CreateService(gfx::GLSurface* gl_surface);
92 void DestroyService();
93 // Returns true if the object has GL service, either a working one or one
94 // that has lost its GL context.
95 bool HasService() const;
96 void MarkServiceContextLost();
97 bool WasServiceContextLost() const;
98 bool IsCompatibleSurface(gfx::GLSurface* gl_surface);
99 bool Flush(gfx::GLSurface* gl_surface);
100
101 Display* display_;
102 const Config* config_;
103 bool is_current_in_some_thread_;
104 bool is_destroyed_;
105 gpu::GpuPreferences gpu_preferences_;
106 scoped_ptr<gpu::CommandBufferService> command_buffer_;
107 scoped_ptr<gpu::gles2::GLES2CmdHelper> gles2_cmd_helper_;
108 scoped_ptr<gpu::gles2::GLES2Decoder> decoder_;
109 scoped_ptr<gpu::CommandExecutor> command_executor_;
110 scoped_ptr<gpu::TransferBuffer> transfer_buffer_;
111
112 scoped_refptr<gfx::GLContext> gl_context_;
113
114 scoped_ptr<gpu::gles2::GLES2Interface> client_gl_context_;
115 DISALLOW_COPY_AND_ASSIGN(Context);
116 };
117
118 } // namespace egl
119
120 #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