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