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

Side by Side Diff: chrome/browser/android/vr_shell/vr_shell_gl.h

Issue 2861343002: Enable gpu rasterization in the vr shell
Patch Set: additional trace instrumentation Created 3 years, 7 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
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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 CHROME_BROWSER_ANDROID_VR_SHELL_VR_SHELL_GL_H_ 5 #ifndef CHROME_BROWSER_ANDROID_VR_SHELL_VR_SHELL_GL_H_
6 #define CHROME_BROWSER_ANDROID_VR_SHELL_VR_SHELL_GL_H_ 6 #define CHROME_BROWSER_ANDROID_VR_SHELL_VR_SHELL_GL_H_
7 7
8 #include <memory> 8 #include <memory>
9 #include <queue> 9 #include <queue>
10 #include <utility> 10 #include <utility>
11 #include <vector> 11 #include <vector>
12 12
13 #include "base/cancelable_callback.h" 13 #include "base/cancelable_callback.h"
14 #include "base/macros.h" 14 #include "base/macros.h"
15 #include "base/memory/ref_counted.h" 15 #include "base/memory/ref_counted.h"
16 #include "base/memory/weak_ptr.h" 16 #include "base/memory/weak_ptr.h"
17 #include "base/single_thread_task_runner.h" 17 #include "base/single_thread_task_runner.h"
18 #include "chrome/browser/android/vr_shell/vr_controller_model.h" 18 #include "chrome/browser/android/vr_shell/vr_controller_model.h"
19 #include "chrome/browser/android/vr_shell/vr_surface_provider.h"
19 #include "device/vr/vr_service.mojom.h" 20 #include "device/vr/vr_service.mojom.h"
20 #include "device/vr/vr_types.h" 21 #include "device/vr/vr_types.h"
21 #include "mojo/public/cpp/bindings/binding.h" 22 #include "mojo/public/cpp/bindings/binding.h"
22 #include "third_party/gvr-android-sdk/src/libraries/headers/vr/gvr/capi/include/ gvr.h" 23 #include "third_party/gvr-android-sdk/src/libraries/headers/vr/gvr/capi/include/ gvr.h"
23 #include "third_party/gvr-android-sdk/src/libraries/headers/vr/gvr/capi/include/ gvr_types.h" 24 #include "third_party/gvr-android-sdk/src/libraries/headers/vr/gvr/capi/include/ gvr_types.h"
24 #include "ui/gfx/native_widget_types.h" 25 #include "ui/gfx/native_widget_types.h"
25 26
27 class GrContext;
28 struct GrGLInterface;
29
26 namespace blink { 30 namespace blink {
27 class WebInputEvent; 31 class WebInputEvent;
28 } 32 }
29 33
30 namespace gl { 34 namespace gl {
31 class GLContext; 35 class GLContext;
32 class GLSurface; 36 class GLSurface;
33 class ScopedJavaSurface; 37 class ScopedJavaSurface;
34 class SurfaceTexture; 38 class SurfaceTexture;
35 } 39 }
(...skipping 18 matching lines...) Expand all
54 const gfx::RectF& right, 58 const gfx::RectF& right,
55 const gfx::Size& size) 59 const gfx::Size& size)
56 : left_bounds(left), right_bounds(right), source_size(size) {} 60 : left_bounds(left), right_bounds(right), source_size(size) {}
57 gfx::RectF left_bounds; 61 gfx::RectF left_bounds;
58 gfx::RectF right_bounds; 62 gfx::RectF right_bounds;
59 gfx::Size source_size; 63 gfx::Size source_size;
60 }; 64 };
61 65
62 // This class manages all GLThread owned objects and GL rendering for VrShell. 66 // This class manages all GLThread owned objects and GL rendering for VrShell.
63 // It is not threadsafe and must only be used on the GL thread. 67 // It is not threadsafe and must only be used on the GL thread.
64 class VrShellGl : public device::mojom::VRVSyncProvider { 68 class VrShellGl : public device::mojom::VRVSyncProvider,
69 public VrSurfaceProvider {
65 public: 70 public:
66 enum class InputTarget { 71 enum class InputTarget {
67 NONE = 0, 72 NONE = 0,
68 CONTENT, 73 CONTENT,
69 }; 74 };
70 75
71 VrShellGl(VrBrowserInterface* browser, 76 VrShellGl(VrBrowserInterface* browser,
72 gvr_context* gvr_api, 77 gvr_context* gvr_api,
73 bool initially_web_vr, 78 bool initially_web_vr,
74 bool reprojected_rendering, 79 bool reprojected_rendering,
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
144 void CreateUiSurface(); 149 void CreateUiSurface();
145 void OnContentFrameAvailable(); 150 void OnContentFrameAvailable();
146 void OnWebVRFrameAvailable(); 151 void OnWebVRFrameAvailable();
147 bool GetPixelEncodedFrameIndex(uint16_t* frame_index); 152 bool GetPixelEncodedFrameIndex(uint16_t* frame_index);
148 153
149 void OnVSync(); 154 void OnVSync();
150 155
151 // VRVSyncProvider 156 // VRVSyncProvider
152 void GetVSync(const GetVSyncCallback& callback) override; 157 void GetVSync(const GetVSyncCallback& callback) override;
153 158
159 // VrSurfaceProvider
160 sk_sp<SkSurface> MakeSurface(int width, int height) override;
161
154 void ForceExitVr(); 162 void ForceExitVr();
155 163
156 void SendVSync(base::TimeDelta time, const GetVSyncCallback& callback); 164 void SendVSync(base::TimeDelta time, const GetVSyncCallback& callback);
157 165
158 // samplerExternalOES texture data for main content image. 166 // samplerExternalOES texture data for main content image.
159 int content_texture_id_ = 0; 167 int content_texture_id_ = 0;
160 // samplerExternalOES texture data for WebVR content image. 168 // samplerExternalOES texture data for WebVR content image.
161 int webvr_texture_id_ = 0; 169 int webvr_texture_id_ = 0;
162 170
163 scoped_refptr<gl::GLSurface> surface_; 171 scoped_refptr<gl::GLSurface> surface_;
164 scoped_refptr<gl::GLContext> context_; 172 scoped_refptr<gl::GLContext> context_;
165 scoped_refptr<gl::SurfaceTexture> content_surface_texture_; 173 scoped_refptr<gl::SurfaceTexture> content_surface_texture_;
166 scoped_refptr<gl::SurfaceTexture> webvr_surface_texture_; 174 scoped_refptr<gl::SurfaceTexture> webvr_surface_texture_;
167 175
176 GrContext* gr_context_ = nullptr;
177 const GrGLInterface* gr_interface_ = nullptr;
178
168 std::unique_ptr<gl::ScopedJavaSurface> content_surface_; 179 std::unique_ptr<gl::ScopedJavaSurface> content_surface_;
169 180
170 std::unique_ptr<gvr::GvrApi> gvr_api_; 181 std::unique_ptr<gvr::GvrApi> gvr_api_;
171 std::unique_ptr<gvr::BufferViewportList> buffer_viewport_list_; 182 std::unique_ptr<gvr::BufferViewportList> buffer_viewport_list_;
172 std::unique_ptr<gvr::BufferViewport> buffer_viewport_; 183 std::unique_ptr<gvr::BufferViewport> buffer_viewport_;
173 std::unique_ptr<gvr::BufferViewport> headlocked_left_viewport_; 184 std::unique_ptr<gvr::BufferViewport> headlocked_left_viewport_;
174 std::unique_ptr<gvr::BufferViewport> headlocked_right_viewport_; 185 std::unique_ptr<gvr::BufferViewport> headlocked_right_viewport_;
175 std::unique_ptr<gvr::BufferViewport> webvr_left_viewport_; 186 std::unique_ptr<gvr::BufferViewport> webvr_left_viewport_;
176 std::unique_ptr<gvr::BufferViewport> webvr_right_viewport_; 187 std::unique_ptr<gvr::BufferViewport> webvr_right_viewport_;
177 std::unique_ptr<gvr::SwapChain> swap_chain_; 188 std::unique_ptr<gvr::SwapChain> swap_chain_;
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
245 gfx::Point3F pointer_start_; 256 gfx::Point3F pointer_start_;
246 257
247 base::WeakPtrFactory<VrShellGl> weak_ptr_factory_; 258 base::WeakPtrFactory<VrShellGl> weak_ptr_factory_;
248 259
249 DISALLOW_COPY_AND_ASSIGN(VrShellGl); 260 DISALLOW_COPY_AND_ASSIGN(VrShellGl);
250 }; 261 };
251 262
252 } // namespace vr_shell 263 } // namespace vr_shell
253 264
254 #endif // CHROME_BROWSER_ANDROID_VR_SHELL_VR_SHELL_GL_H_ 265 #endif // CHROME_BROWSER_ANDROID_VR_SHELL_VR_SHELL_GL_H_
OLDNEW
« no previous file with comments | « chrome/browser/android/vr_shell/ui_scene.cc ('k') | chrome/browser/android/vr_shell/vr_shell_gl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698