Index: chrome/browser/android/vr_shell/vr_shell_gl.h |
diff --git a/chrome/browser/android/vr_shell/vr_shell_gl.h b/chrome/browser/android/vr_shell/vr_shell_gl.h |
index 1f82f88c4c292b42f0b2f7586a3c4d30cf0b0116..7ec43553ac4d3ff0c2191ed3e300eb46aa99b0a5 100644 |
--- a/chrome/browser/android/vr_shell/vr_shell_gl.h |
+++ b/chrome/browser/android/vr_shell/vr_shell_gl.h |
@@ -72,6 +72,7 @@ class VrShellGl : public device::mojom::VRVSyncProvider { |
void OnResume(); |
void SetWebVrMode(bool enabled); |
+ void CreateWebVRSurface(); |
void CreateContentSurface(); |
void ContentBoundsChanged(int width, int height); |
void ContentPhysicalBoundsChanged(int width, int height); |
@@ -94,11 +95,13 @@ class VrShellGl : public device::mojom::VRVSyncProvider { |
void CreateVRDisplayInfo( |
const base::Callback<void(device::mojom::VRDisplayInfoPtr)>& callback, |
uint32_t device_id); |
+ void ScheduleWebVRFrame(int frame_index); |
+ void DropWebVRFrame(int frame_index); |
private: |
void GvrInit(gvr_context* gvr_api); |
void InitializeRenderer(); |
- void DrawFrame(); |
+ void DrawFrame(int frame_index); |
void DrawVrShell(const gvr::Mat4f& head_pose, gvr::Frame& frame); |
void DrawUiView(const gvr::Mat4f* head_pose, |
const std::vector<const ContentRectangle*>& elements, |
@@ -121,6 +124,7 @@ class VrShellGl : public device::mojom::VRVSyncProvider { |
void CreateUiSurface(); |
void OnUIFrameAvailable(); |
void OnContentFrameAvailable(); |
+ void OnWebVRFrameAvailable(); |
bool GetPixelEncodedFrameIndex(uint16_t* frame_index); |
void OnVSync(); |
@@ -136,6 +140,8 @@ class VrShellGl : public device::mojom::VRVSyncProvider { |
int ui_texture_id_ = 0; |
// samplerExternalOES texture data for main content image. |
int content_texture_id_ = 0; |
+ // samplerExternalOES texture data for WebVR content image. |
+ int webvr_texture_id_ = 0; |
std::unique_ptr<UiScene> scene_; |
@@ -143,9 +149,12 @@ class VrShellGl : public device::mojom::VRVSyncProvider { |
scoped_refptr<gl::GLContext> context_; |
scoped_refptr<gl::SurfaceTexture> ui_surface_texture_; |
scoped_refptr<gl::SurfaceTexture> content_surface_texture_; |
+ scoped_refptr<gl::SurfaceTexture> webvr_surface_texture_; |
std::unique_ptr<gl::ScopedJavaSurface> ui_surface_; |
std::unique_ptr<gl::ScopedJavaSurface> content_surface_; |
+ std::unique_ptr<gl::ScopedJavaSurface> webvr_surface_; |
+ int webvr_surface_handle_; |
std::unique_ptr<gvr::GvrApi> gvr_api_; |
std::unique_ptr<gvr::BufferViewportList> buffer_viewport_list_; |
@@ -157,6 +166,9 @@ class VrShellGl : public device::mojom::VRVSyncProvider { |
std::unique_ptr<gvr::SwapChain> swap_chain_; |
using BoundsPair = std::pair<gvr::Rectf, gvr::Rectf>; |
std::queue<std::pair<uint8_t, BoundsPair>> pending_bounds_; |
+ int requested_frames_ = 0; |
+ int premature_received_frames_ = 0; |
+ std::queue<uint16_t> pending_frames_; |
// Current sizes for the render buffers. |
gvr::Sizei render_size_primary_; |
@@ -179,7 +191,6 @@ class VrShellGl : public device::mojom::VRVSyncProvider { |
gvr::Sizei ui_tex_physical_size_ = {0, 0}; |
std::vector<gvr::Mat4f> webvr_head_pose_; |
- int webvr_texture_id_ = 0; |
bool web_vr_mode_; |
bool ready_to_draw_ = false; |
bool surfaceless_rendering_; |