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

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

Issue 2809143004: VR: Add a native UI element scene manager (Closed)
Patch Set: Created 3 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
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 "device/vr/vr_service.mojom.h" 19 #include "device/vr/vr_service.mojom.h"
20 #include "mojo/public/cpp/bindings/binding.h" 20 #include "mojo/public/cpp/bindings/binding.h"
21 #include "third_party/gvr-android-sdk/src/libraries/headers/vr/gvr/capi/include/ gvr.h" 21 #include "third_party/gvr-android-sdk/src/libraries/headers/vr/gvr/capi/include/ gvr.h"
22 #include "third_party/gvr-android-sdk/src/libraries/headers/vr/gvr/capi/include/ gvr_types.h" 22 #include "third_party/gvr-android-sdk/src/libraries/headers/vr/gvr/capi/include/ gvr_types.h"
23 #include "ui/gfx/native_widget_types.h" 23 #include "ui/gfx/native_widget_types.h"
24 24
25 namespace base {
26 class ListValue;
27 }
28
29 namespace blink { 25 namespace blink {
30 class WebInputEvent; 26 class WebInputEvent;
31 } 27 }
32 28
33 namespace gl { 29 namespace gl {
34 class GLContext; 30 class GLContext;
35 class GLSurface; 31 class GLSurface;
36 class ScopedJavaSurface; 32 class ScopedJavaSurface;
37 class SurfaceTexture; 33 class SurfaceTexture;
38 } 34 }
(...skipping 26 matching lines...) Expand all
65 enum class InputTarget { 61 enum class InputTarget {
66 NONE = 0, 62 NONE = 0,
67 CONTENT, 63 CONTENT,
68 UI, 64 UI,
69 }; 65 };
70 66
71 VrShellGl(const base::WeakPtr<VrShell>& weak_vr_shell, 67 VrShellGl(const base::WeakPtr<VrShell>& weak_vr_shell,
72 scoped_refptr<base::SingleThreadTaskRunner> main_thread_task_runner, 68 scoped_refptr<base::SingleThreadTaskRunner> main_thread_task_runner,
73 gvr_context* gvr_api, 69 gvr_context* gvr_api,
74 bool initially_web_vr, 70 bool initially_web_vr,
75 bool reprojected_rendering); 71 bool reprojected_rendering,
72 UiScene* scene);
76 ~VrShellGl() override; 73 ~VrShellGl() override;
77 74
78 void Initialize(); 75 void Initialize();
79 void InitializeGl(gfx::AcceleratedWidget window); 76 void InitializeGl(gfx::AcceleratedWidget window);
80 77
81 void OnTriggerEvent(); 78 void OnTriggerEvent();
82 void OnPause(); 79 void OnPause();
83 void OnResume(); 80 void OnResume();
84 81
85 void SetWebVrMode(bool enabled); 82 void SetWebVrMode(bool enabled);
86 void CreateOrResizeWebVRSurface(const gvr::Sizei& size); 83 void CreateOrResizeWebVRSurface(const gvr::Sizei& size);
87 void CreateContentSurface(); 84 void CreateContentSurface();
88 void ContentBoundsChanged(int width, int height); 85 void ContentBoundsChanged(int width, int height);
89 void ContentPhysicalBoundsChanged(int width, int height); 86 void ContentPhysicalBoundsChanged(int width, int height);
90 void UIBoundsChanged(int width, int height); 87 void UIBoundsChanged(int width, int height);
91 void UIPhysicalBoundsChanged(int width, int height); 88 void UIPhysicalBoundsChanged(int width, int height);
92 base::WeakPtr<VrShellGl> GetWeakPtr(); 89 base::WeakPtr<VrShellGl> GetWeakPtr();
93 90
94 void SetControllerModel(std::unique_ptr<VrControllerModel> model); 91 void SetControllerModel(std::unique_ptr<VrControllerModel> model);
95 92
96 void UpdateWebVRTextureBounds(int16_t frame_index, 93 void UpdateWebVRTextureBounds(int16_t frame_index,
97 const gvr::Rectf& left_bounds, 94 const gvr::Rectf& left_bounds,
98 const gvr::Rectf& right_bounds, 95 const gvr::Rectf& right_bounds,
99 const gvr::Sizei& source_size); 96 const gvr::Sizei& source_size);
100 97
101 void UpdateScene(std::unique_ptr<base::ListValue> commands);
102
103 void UpdateVSyncInterval(int64_t timebase_nanos, double interval_seconds); 98 void UpdateVSyncInterval(int64_t timebase_nanos, double interval_seconds);
104 99
105 void OnRequest(device::mojom::VRVSyncProviderRequest request); 100 void OnRequest(device::mojom::VRVSyncProviderRequest request);
106 void CreateVRDisplayInfo( 101 void CreateVRDisplayInfo(
107 const base::Callback<void(device::mojom::VRDisplayInfoPtr)>& callback, 102 const base::Callback<void(device::mojom::VRDisplayInfoPtr)>& callback,
108 uint32_t device_id); 103 uint32_t device_id);
109 void SubmitWebVRFrame(int16_t frame_index, const gpu::MailboxHolder& mailbox); 104 void SubmitWebVRFrame(int16_t frame_index, const gpu::MailboxHolder& mailbox);
110 void SetSubmitClient( 105 void SetSubmitClient(
111 device::mojom::VRSubmitFrameClientPtrInfo submit_client_info); 106 device::mojom::VRSubmitFrameClientPtrInfo submit_client_info);
112 107
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
154 149
155 void SendVSync(base::TimeDelta time, const GetVSyncCallback& callback); 150 void SendVSync(base::TimeDelta time, const GetVSyncCallback& callback);
156 151
157 // samplerExternalOES texture data for UI content image. 152 // samplerExternalOES texture data for UI content image.
158 int ui_texture_id_ = 0; 153 int ui_texture_id_ = 0;
159 // samplerExternalOES texture data for main content image. 154 // samplerExternalOES texture data for main content image.
160 int content_texture_id_ = 0; 155 int content_texture_id_ = 0;
161 // samplerExternalOES texture data for WebVR content image. 156 // samplerExternalOES texture data for WebVR content image.
162 int webvr_texture_id_ = 0; 157 int webvr_texture_id_ = 0;
163 158
164 std::unique_ptr<UiScene> scene_; 159 UiScene* scene_;
165 160
166 scoped_refptr<gl::GLSurface> surface_; 161 scoped_refptr<gl::GLSurface> surface_;
167 scoped_refptr<gl::GLContext> context_; 162 scoped_refptr<gl::GLContext> context_;
168 scoped_refptr<gl::SurfaceTexture> ui_surface_texture_; 163 scoped_refptr<gl::SurfaceTexture> ui_surface_texture_;
169 scoped_refptr<gl::SurfaceTexture> content_surface_texture_; 164 scoped_refptr<gl::SurfaceTexture> content_surface_texture_;
170 scoped_refptr<gl::SurfaceTexture> webvr_surface_texture_; 165 scoped_refptr<gl::SurfaceTexture> webvr_surface_texture_;
171 166
172 std::unique_ptr<gl::ScopedJavaSurface> ui_surface_; 167 std::unique_ptr<gl::ScopedJavaSurface> ui_surface_;
173 std::unique_ptr<gl::ScopedJavaSurface> content_surface_; 168 std::unique_ptr<gl::ScopedJavaSurface> content_surface_;
174 169
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
240 gvr::Vec3f controller_start_direction_; 235 gvr::Vec3f controller_start_direction_;
241 236
242 base::WeakPtrFactory<VrShellGl> weak_ptr_factory_; 237 base::WeakPtrFactory<VrShellGl> weak_ptr_factory_;
243 238
244 DISALLOW_COPY_AND_ASSIGN(VrShellGl); 239 DISALLOW_COPY_AND_ASSIGN(VrShellGl);
245 }; 240 };
246 241
247 } // namespace vr_shell 242 } // namespace vr_shell
248 243
249 #endif // CHROME_BROWSER_ANDROID_VR_SHELL_VR_SHELL_GL_H_ 244 #endif // CHROME_BROWSER_ANDROID_VR_SHELL_VR_SHELL_GL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698