| OLD | NEW |
| 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> |
| (...skipping 29 matching lines...) Expand all Loading... |
| 40 struct MailboxHolder; | 40 struct MailboxHolder; |
| 41 } | 41 } |
| 42 | 42 |
| 43 namespace vr_shell { | 43 namespace vr_shell { |
| 44 | 44 |
| 45 class FPSMeter; | 45 class FPSMeter; |
| 46 class MailboxToSurfaceBridge; | 46 class MailboxToSurfaceBridge; |
| 47 class SlidingAverage; | 47 class SlidingAverage; |
| 48 class UiElement; | 48 class UiElement; |
| 49 class UiScene; | 49 class UiScene; |
| 50 class VrBrowserInterface; | 50 class GlBrowserInterface; |
| 51 class VrController; | 51 class VrController; |
| 52 class VrShell; | 52 class VrShell; |
| 53 class VrShellRenderer; | 53 class VrShellRenderer; |
| 54 | 54 |
| 55 struct WebVrBounds { | 55 struct WebVrBounds { |
| 56 WebVrBounds(const gfx::RectF& left, | 56 WebVrBounds(const gfx::RectF& left, |
| 57 const gfx::RectF& right, | 57 const gfx::RectF& right, |
| 58 const gfx::Size& size) | 58 const gfx::Size& size) |
| 59 : left_bounds(left), right_bounds(right), source_size(size) {} | 59 : left_bounds(left), right_bounds(right), source_size(size) {} |
| 60 gfx::RectF left_bounds; | 60 gfx::RectF left_bounds; |
| 61 gfx::RectF right_bounds; | 61 gfx::RectF right_bounds; |
| 62 gfx::Size source_size; | 62 gfx::Size source_size; |
| 63 }; | 63 }; |
| 64 | 64 |
| 65 // This class manages all GLThread owned objects and GL rendering for VrShell. | 65 // This class manages all GLThread owned objects and GL rendering for VrShell. |
| 66 // It is not threadsafe and must only be used on the GL thread. | 66 // It is not threadsafe and must only be used on the GL thread. |
| 67 class VrShellGl : public device::mojom::VRVSyncProvider { | 67 class VrShellGl : public device::mojom::VRVSyncProvider { |
| 68 public: | 68 public: |
| 69 VrShellGl(VrBrowserInterface* browser, | 69 VrShellGl(GlBrowserInterface* browser, |
| 70 gvr_context* gvr_api, | 70 gvr_context* gvr_api, |
| 71 bool initially_web_vr, | 71 bool initially_web_vr, |
| 72 bool reprojected_rendering, | 72 bool reprojected_rendering, |
| 73 bool daydream_support, | 73 bool daydream_support, |
| 74 UiScene* scene); | 74 UiScene* scene); |
| 75 ~VrShellGl() override; | 75 ~VrShellGl() override; |
| 76 | 76 |
| 77 void Initialize(); | 77 void Initialize(); |
| 78 void InitializeGl(gfx::AcceleratedWidget window); | 78 void InitializeGl(gfx::AcceleratedWidget window); |
| 79 | 79 |
| (...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 259 base::TimeTicks vsync_timebase_; | 259 base::TimeTicks vsync_timebase_; |
| 260 base::TimeDelta vsync_interval_; | 260 base::TimeDelta vsync_interval_; |
| 261 | 261 |
| 262 base::TimeDelta pending_time_; | 262 base::TimeDelta pending_time_; |
| 263 bool pending_vsync_ = false; | 263 bool pending_vsync_ = false; |
| 264 GetVSyncCallback callback_; | 264 GetVSyncCallback callback_; |
| 265 bool received_frame_ = false; | 265 bool received_frame_ = false; |
| 266 mojo::Binding<device::mojom::VRVSyncProvider> binding_; | 266 mojo::Binding<device::mojom::VRVSyncProvider> binding_; |
| 267 device::mojom::VRSubmitFrameClientPtr submit_client_; | 267 device::mojom::VRSubmitFrameClientPtr submit_client_; |
| 268 | 268 |
| 269 VrBrowserInterface* browser_; | 269 GlBrowserInterface* browser_; |
| 270 | 270 |
| 271 UiScene* scene_ = nullptr; | 271 UiScene* scene_ = nullptr; |
| 272 | 272 |
| 273 uint8_t frame_index_ = 0; | 273 uint8_t frame_index_ = 0; |
| 274 // Larger than frame_index_ so it can be initialized out-of-band. | 274 // Larger than frame_index_ so it can be initialized out-of-band. |
| 275 uint16_t last_frame_index_ = -1; | 275 uint16_t last_frame_index_ = -1; |
| 276 | 276 |
| 277 // Attributes for gesture detection while holding app button. | 277 // Attributes for gesture detection while holding app button. |
| 278 gfx::Vector3dF controller_start_direction_; | 278 gfx::Vector3dF controller_start_direction_; |
| 279 | 279 |
| 280 std::unique_ptr<FPSMeter> fps_meter_; | 280 std::unique_ptr<FPSMeter> fps_meter_; |
| 281 | 281 |
| 282 std::unique_ptr<SlidingAverage> webvr_js_time_; | 282 std::unique_ptr<SlidingAverage> webvr_js_time_; |
| 283 std::unique_ptr<SlidingAverage> webvr_render_time_; | 283 std::unique_ptr<SlidingAverage> webvr_render_time_; |
| 284 | 284 |
| 285 gfx::Point3F pointer_start_; | 285 gfx::Point3F pointer_start_; |
| 286 | 286 |
| 287 base::WeakPtrFactory<VrShellGl> weak_ptr_factory_; | 287 base::WeakPtrFactory<VrShellGl> weak_ptr_factory_; |
| 288 | 288 |
| 289 DISALLOW_COPY_AND_ASSIGN(VrShellGl); | 289 DISALLOW_COPY_AND_ASSIGN(VrShellGl); |
| 290 }; | 290 }; |
| 291 | 291 |
| 292 } // namespace vr_shell | 292 } // namespace vr_shell |
| 293 | 293 |
| 294 #endif // CHROME_BROWSER_ANDROID_VR_SHELL_VR_SHELL_GL_H_ | 294 #endif // CHROME_BROWSER_ANDROID_VR_SHELL_VR_SHELL_GL_H_ |
| OLD | NEW |