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

Side by Side Diff: cc/output/output_surface.h

Issue 1892303003: Added the Vulkan Context Provider implementation. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Export VulkanContextProvider 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 | « cc/cc.gyp ('k') | cc/output/output_surface.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2012 The Chromium Authors. All rights reserved. 1 // Copyright 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef CC_OUTPUT_OUTPUT_SURFACE_H_ 5 #ifndef CC_OUTPUT_OUTPUT_SURFACE_H_
6 #define CC_OUTPUT_OUTPUT_SURFACE_H_ 6 #define CC_OUTPUT_OUTPUT_SURFACE_H_
7 7
8 #include <deque> 8 #include <deque>
9 #include <memory> 9 #include <memory>
10 10
11 #include "base/macros.h" 11 #include "base/macros.h"
12 #include "base/memory/ref_counted.h" 12 #include "base/memory/ref_counted.h"
13 #include "base/memory/weak_ptr.h" 13 #include "base/memory/weak_ptr.h"
14 #include "base/threading/thread_checker.h" 14 #include "base/threading/thread_checker.h"
15 #include "cc/base/cc_export.h" 15 #include "cc/base/cc_export.h"
16 #include "cc/output/context_provider.h" 16 #include "cc/output/context_provider.h"
17 #include "cc/output/overlay_candidate_validator.h" 17 #include "cc/output/overlay_candidate_validator.h"
18 #include "cc/output/software_output_device.h" 18 #include "cc/output/software_output_device.h"
19
20 #if defined(ENABLE_VULKAN)
21 #include "cc/output/vulkan_context_provider.h" 19 #include "cc/output/vulkan_context_provider.h"
22 #endif
23 20
24 namespace base { class SingleThreadTaskRunner; } 21 namespace base { class SingleThreadTaskRunner; }
25 22
26 namespace ui { 23 namespace ui {
27 class LatencyInfo; 24 class LatencyInfo;
28 } 25 }
29 26
30 namespace gfx { 27 namespace gfx {
31 class Rect; 28 class Rect;
32 class Size; 29 class Size;
(...skipping 11 matching lines...) Expand all
44 // and manages its destruction. Its lifetime is: 41 // and manages its destruction. Its lifetime is:
45 // 1. Created on the main thread by the LayerTreeHost through its client. 42 // 1. Created on the main thread by the LayerTreeHost through its client.
46 // 2. Passed to the compositor thread and bound to a client via BindToClient. 43 // 2. Passed to the compositor thread and bound to a client via BindToClient.
47 // From here on, it will only be used on the compositor thread. 44 // From here on, it will only be used on the compositor thread.
48 // 3. If the 3D context is lost, then the compositor will delete the output 45 // 3. If the 3D context is lost, then the compositor will delete the output
49 // surface (on the compositor thread) and go back to step 1. 46 // surface (on the compositor thread) and go back to step 1.
50 class CC_EXPORT OutputSurface : public base::trace_event::MemoryDumpProvider { 47 class CC_EXPORT OutputSurface : public base::trace_event::MemoryDumpProvider {
51 public: 48 public:
52 OutputSurface(scoped_refptr<ContextProvider> context_provider, 49 OutputSurface(scoped_refptr<ContextProvider> context_provider,
53 scoped_refptr<ContextProvider> worker_context_provider, 50 scoped_refptr<ContextProvider> worker_context_provider,
54 #if defined(ENABLE_VULKAN)
55 scoped_refptr<VulkanContextProvider> vulkan_context_provider, 51 scoped_refptr<VulkanContextProvider> vulkan_context_provider,
56 #endif
57 std::unique_ptr<SoftwareOutputDevice> software_device); 52 std::unique_ptr<SoftwareOutputDevice> software_device);
58 OutputSurface(scoped_refptr<ContextProvider> context_provider, 53 OutputSurface(scoped_refptr<ContextProvider> context_provider,
59 scoped_refptr<ContextProvider> worker_context_provider); 54 scoped_refptr<ContextProvider> worker_context_provider);
60 explicit OutputSurface(scoped_refptr<ContextProvider> context_provider); 55 explicit OutputSurface(scoped_refptr<ContextProvider> context_provider);
61 #if defined(ENABLE_VULKAN)
62 explicit OutputSurface(
63 scoped_refptr<VulkanContextProvider> vulkan_context_provider);
64 #endif
65 explicit OutputSurface(std::unique_ptr<SoftwareOutputDevice> software_device); 56 explicit OutputSurface(std::unique_ptr<SoftwareOutputDevice> software_device);
66 57
67 OutputSurface(scoped_refptr<ContextProvider> context_provider, 58 OutputSurface(scoped_refptr<ContextProvider> context_provider,
68 std::unique_ptr<SoftwareOutputDevice> software_device); 59 std::unique_ptr<SoftwareOutputDevice> software_device);
69 60
70 ~OutputSurface() override; 61 ~OutputSurface() override;
71 62
72 struct Capabilities { 63 struct Capabilities {
73 Capabilities() 64 Capabilities()
74 : delegated_rendering(false), 65 : delegated_rendering(false),
(...skipping 29 matching lines...) Expand all
104 virtual void ApplyExternalStencil(); 95 virtual void ApplyExternalStencil();
105 96
106 // Obtain the 3d context or the software device associated with this output 97 // Obtain the 3d context or the software device associated with this output
107 // surface. Either of these may return a null pointer, but not both. 98 // surface. Either of these may return a null pointer, but not both.
108 // In the event of a lost context, the entire output surface should be 99 // In the event of a lost context, the entire output surface should be
109 // recreated. 100 // recreated.
110 ContextProvider* context_provider() const { return context_provider_.get(); } 101 ContextProvider* context_provider() const { return context_provider_.get(); }
111 ContextProvider* worker_context_provider() const { 102 ContextProvider* worker_context_provider() const {
112 return worker_context_provider_.get(); 103 return worker_context_provider_.get();
113 } 104 }
114 #if defined(ENABLE_VULKAN)
115 VulkanContextProvider* vulkan_context_provider() const { 105 VulkanContextProvider* vulkan_context_provider() const {
116 return vulkan_context_provider_.get(); 106 return vulkan_context_provider_.get();
117 } 107 }
118 #endif
119 SoftwareOutputDevice* software_device() const { 108 SoftwareOutputDevice* software_device() const {
120 return software_device_.get(); 109 return software_device_.get();
121 } 110 }
122 111
123 // Called by the compositor on the compositor thread. This is a place where 112 // Called by the compositor on the compositor thread. This is a place where
124 // thread-specific data for the output surface can be initialized, since from 113 // thread-specific data for the output surface can be initialized, since from
125 // this point to when DetachFromClient() is called the output surface will 114 // this point to when DetachFromClient() is called the output surface will
126 // only be used on the compositor thread. 115 // only be used on the compositor thread.
127 virtual bool BindToClient(OutputSurfaceClient* client); 116 virtual bool BindToClient(OutputSurfaceClient* client);
128 117
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
183 base::trace_event::ProcessMemoryDump* pmd) override; 172 base::trace_event::ProcessMemoryDump* pmd) override;
184 173
185 protected: 174 protected:
186 OutputSurfaceClient* client_; 175 OutputSurfaceClient* client_;
187 176
188 void PostSwapBuffersComplete(); 177 void PostSwapBuffersComplete();
189 178
190 struct OutputSurface::Capabilities capabilities_; 179 struct OutputSurface::Capabilities capabilities_;
191 scoped_refptr<ContextProvider> context_provider_; 180 scoped_refptr<ContextProvider> context_provider_;
192 scoped_refptr<ContextProvider> worker_context_provider_; 181 scoped_refptr<ContextProvider> worker_context_provider_;
193 #if defined(ENABLE_VULKAN)
194 scoped_refptr<VulkanContextProvider> vulkan_context_provider_; 182 scoped_refptr<VulkanContextProvider> vulkan_context_provider_;
195 #endif
196 std::unique_ptr<SoftwareOutputDevice> software_device_; 183 std::unique_ptr<SoftwareOutputDevice> software_device_;
197 gfx::Size surface_size_; 184 gfx::Size surface_size_;
198 float device_scale_factor_; 185 float device_scale_factor_;
199 bool has_alpha_; 186 bool has_alpha_;
200 base::ThreadChecker client_thread_checker_; 187 base::ThreadChecker client_thread_checker_;
201 188
202 void SetNeedsRedrawRect(const gfx::Rect& damage_rect); 189 void SetNeedsRedrawRect(const gfx::Rect& damage_rect);
203 void ReclaimResources(const CompositorFrameAck* ack); 190 void ReclaimResources(const CompositorFrameAck* ack);
204 void SetExternalStencilTest(bool enabled); 191 void SetExternalStencilTest(bool enabled);
205 void DetachFromClientInternal(); 192 void DetachFromClientInternal();
206 193
207 private: 194 private:
208 bool external_stencil_test_enabled_; 195 bool external_stencil_test_enabled_;
209 196
210 base::WeakPtrFactory<OutputSurface> weak_ptr_factory_; 197 base::WeakPtrFactory<OutputSurface> weak_ptr_factory_;
211 198
212 DISALLOW_COPY_AND_ASSIGN(OutputSurface); 199 DISALLOW_COPY_AND_ASSIGN(OutputSurface);
213 }; 200 };
214 201
215 } // namespace cc 202 } // namespace cc
216 203
217 #endif // CC_OUTPUT_OUTPUT_SURFACE_H_ 204 #endif // CC_OUTPUT_OUTPUT_SURFACE_H_
OLDNEW
« no previous file with comments | « cc/cc.gyp ('k') | cc/output/output_surface.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698