| 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 | 9 |
| 10 #include "base/cancelable_callback.h" | 10 #include "base/cancelable_callback.h" |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 68 void ContentBoundsChanged(int width, int height); | 68 void ContentBoundsChanged(int width, int height); |
| 69 void ContentPhysicalBoundsChanged(int width, int height); | 69 void ContentPhysicalBoundsChanged(int width, int height); |
| 70 void UIBoundsChanged(int width, int height); | 70 void UIBoundsChanged(int width, int height); |
| 71 void UIPhysicalBoundsChanged(int width, int height); | 71 void UIPhysicalBoundsChanged(int width, int height); |
| 72 base::WeakPtr<VrShellGl> GetWeakPtr(); | 72 base::WeakPtr<VrShellGl> GetWeakPtr(); |
| 73 | 73 |
| 74 void UpdateWebVRTextureBounds(const gvr::Rectf& left_bounds, | 74 void UpdateWebVRTextureBounds(const gvr::Rectf& left_bounds, |
| 75 const gvr::Rectf& right_bounds); | 75 const gvr::Rectf& right_bounds); |
| 76 gvr::GvrApi* gvr_api(); | 76 gvr::GvrApi* gvr_api(); |
| 77 void SetGvrPoseForWebVr(const gvr::Mat4f& pose, uint32_t pose_num); | 77 void SetGvrPoseForWebVr(const gvr::Mat4f& pose, uint32_t pose_num); |
| 78 void SetWebVRRenderSurfaceSize(int width, int height); | |
| 79 gvr::Sizei GetWebVRCompositorSurfaceSize(); | 78 gvr::Sizei GetWebVRCompositorSurfaceSize(); |
| 80 | 79 |
| 81 UiScene* GetScene() { return scene_.get(); } | 80 UiScene* GetScene() { return scene_.get(); } |
| 82 | 81 |
| 83 private: | 82 private: |
| 84 bool InitializeGl(); | 83 bool InitializeGl(); |
| 85 void GvrInit(gvr_context* gvr_api); | 84 void GvrInit(gvr_context* gvr_api); |
| 86 void InitializeRenderer(); | 85 void InitializeRenderer(); |
| 87 void DrawVrShell(const gvr::Mat4f& head_pose, gvr::Frame &frame); | 86 void DrawVrShell(const gvr::Mat4f& head_pose, gvr::Frame &frame); |
| 88 void DrawUiView(const gvr::Mat4f* head_pose, | 87 void DrawUiView(const gvr::Mat4f* head_pose, |
| (...skipping 11 matching lines...) Expand all Loading... |
| 100 void SendGesture(InputTarget input_target, | 99 void SendGesture(InputTarget input_target, |
| 101 std::unique_ptr<blink::WebInputEvent> event); | 100 std::unique_ptr<blink::WebInputEvent> event); |
| 102 | 101 |
| 103 void OnUIFrameAvailable(); | 102 void OnUIFrameAvailable(); |
| 104 void OnContentFrameAvailable(); | 103 void OnContentFrameAvailable(); |
| 105 | 104 |
| 106 void UpdateVSyncParameters(const base::TimeTicks timebase, | 105 void UpdateVSyncParameters(const base::TimeTicks timebase, |
| 107 const base::TimeDelta interval); | 106 const base::TimeDelta interval); |
| 108 void ScheduleNextDrawFrame(); | 107 void ScheduleNextDrawFrame(); |
| 109 | 108 |
| 110 void ForceExitVR(); | 109 void ForceExitVr(); |
| 111 | 110 |
| 112 // samplerExternalOES texture data for UI content image. | 111 // samplerExternalOES texture data for UI content image. |
| 113 int ui_texture_id_ = 0; | 112 int ui_texture_id_ = 0; |
| 114 // samplerExternalOES texture data for main content image. | 113 // samplerExternalOES texture data for main content image. |
| 115 int content_texture_id_ = 0; | 114 int content_texture_id_ = 0; |
| 116 | 115 |
| 117 std::unique_ptr<UiScene> scene_; | 116 std::unique_ptr<UiScene> scene_; |
| 118 | 117 |
| 119 scoped_refptr<gl::GLSurface> surface_; | 118 scoped_refptr<gl::GLSurface> surface_; |
| 120 scoped_refptr<gl::GLContext> context_; | 119 scoped_refptr<gl::GLContext> context_; |
| 121 scoped_refptr<gl::SurfaceTexture> ui_surface_texture_; | 120 scoped_refptr<gl::SurfaceTexture> ui_surface_texture_; |
| 122 scoped_refptr<gl::SurfaceTexture> content_surface_texture_; | 121 scoped_refptr<gl::SurfaceTexture> content_surface_texture_; |
| 123 | 122 |
| 124 std::unique_ptr<gl::ScopedJavaSurface> ui_surface_; | 123 std::unique_ptr<gl::ScopedJavaSurface> ui_surface_; |
| 125 std::unique_ptr<gl::ScopedJavaSurface> content_surface_; | 124 std::unique_ptr<gl::ScopedJavaSurface> content_surface_; |
| 126 | 125 |
| 127 std::unique_ptr<gvr::GvrApi> gvr_api_; | 126 std::unique_ptr<gvr::GvrApi> gvr_api_; |
| 128 std::unique_ptr<gvr::BufferViewportList> buffer_viewport_list_; | 127 std::unique_ptr<gvr::BufferViewportList> buffer_viewport_list_; |
| 129 std::unique_ptr<gvr::BufferViewport> buffer_viewport_; | 128 std::unique_ptr<gvr::BufferViewport> buffer_viewport_; |
| 130 std::unique_ptr<gvr::BufferViewport> headlocked_left_viewport_; | 129 std::unique_ptr<gvr::BufferViewport> headlocked_left_viewport_; |
| 131 std::unique_ptr<gvr::BufferViewport> headlocked_right_viewport_; | 130 std::unique_ptr<gvr::BufferViewport> headlocked_right_viewport_; |
| 132 std::unique_ptr<gvr::BufferViewport> webvr_left_viewport_; | 131 std::unique_ptr<gvr::BufferViewport> webvr_left_viewport_; |
| 133 std::unique_ptr<gvr::BufferViewport> webvr_right_viewport_; | 132 std::unique_ptr<gvr::BufferViewport> webvr_right_viewport_; |
| 134 std::unique_ptr<gvr::SwapChain> swap_chain_; | 133 std::unique_ptr<gvr::SwapChain> swap_chain_; |
| 135 | 134 |
| 136 // Current sizes for the render buffers. | 135 // Current sizes for the render buffers. |
| 137 gvr::Sizei render_size_primary_; | 136 gvr::Sizei render_size_primary_; |
| 138 gvr::Sizei render_size_headlocked_; | 137 gvr::Sizei render_size_headlocked_; |
| 139 | 138 |
| 140 // Intended size for the primary render buffer by UI mode. | |
| 141 // For WebVR, a size of 0x0 is used to indicate "not yet ready" | |
| 142 // to suppress rendering while still initializing. | |
| 143 gvr::Sizei render_size_primary_webvr_ = device::kInvalidRenderTargetSize; | |
| 144 gvr::Sizei render_size_primary_vrshell_; | |
| 145 | |
| 146 std::unique_ptr<VrShellRenderer> vr_shell_renderer_; | 139 std::unique_ptr<VrShellRenderer> vr_shell_renderer_; |
| 147 | 140 |
| 148 bool touch_pending_ = false; | 141 bool touch_pending_ = false; |
| 149 gvr::Quatf controller_quat_; | 142 gvr::Quatf controller_quat_; |
| 150 | 143 |
| 151 gvr::Vec3f target_point_; | 144 gvr::Vec3f target_point_; |
| 152 const ContentRectangle* target_element_ = nullptr; | 145 const ContentRectangle* target_element_ = nullptr; |
| 153 InputTarget current_input_target_ = InputTarget::NONE; | 146 InputTarget current_input_target_ = InputTarget::NONE; |
| 154 int ui_tex_css_width_ = 0; | 147 int ui_tex_css_width_ = 0; |
| 155 int ui_tex_css_height_ = 0; | 148 int ui_tex_css_height_ = 0; |
| (...skipping 25 matching lines...) Expand all Loading... |
| 181 scoped_refptr<base::SingleThreadTaskRunner> main_thread_task_runner_; | 174 scoped_refptr<base::SingleThreadTaskRunner> main_thread_task_runner_; |
| 182 | 175 |
| 183 base::WeakPtrFactory<VrShellGl> weak_ptr_factory_; | 176 base::WeakPtrFactory<VrShellGl> weak_ptr_factory_; |
| 184 | 177 |
| 185 DISALLOW_COPY_AND_ASSIGN(VrShellGl); | 178 DISALLOW_COPY_AND_ASSIGN(VrShellGl); |
| 186 }; | 179 }; |
| 187 | 180 |
| 188 } // namespace vr_shell | 181 } // namespace vr_shell |
| 189 | 182 |
| 190 #endif // CHROME_BROWSER_ANDROID_VR_SHELL_VR_SHELL_GL_H_ | 183 #endif // CHROME_BROWSER_ANDROID_VR_SHELL_VR_SHELL_GL_H_ |
| OLD | NEW |