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..a705b023bfd1c47a15a1c0af648775222358203e 100644 |
--- a/chrome/browser/android/vr_shell/vr_shell_gl.h |
+++ b/chrome/browser/android/vr_shell/vr_shell_gl.h |
@@ -37,11 +37,16 @@ class ScopedJavaSurface; |
class SurfaceTexture; |
} |
+namespace gpu { |
+class Mailbox; |
+} |
+ |
namespace vr_shell { |
class UiScene; |
class VrController; |
class VrShell; |
+class VrShellCommandBufferGl; |
class VrShellDelegate; |
class VrShellRenderer; |
struct ContentRectangle; |
@@ -72,6 +77,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 +100,12 @@ class VrShellGl : public device::mojom::VRVSyncProvider { |
void CreateVRDisplayInfo( |
const base::Callback<void(device::mojom::VRDisplayInfoPtr)>& callback, |
uint32_t device_id); |
+ void SubmitWebVRFrame(int frame_index, const gpu::Mailbox& mailbox); |
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 +128,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 +144,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,6 +153,7 @@ 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_; |
@@ -157,6 +168,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 premature_received_frames_ = 0; |
+ std::queue<uint16_t> pending_frames_; |
+ std::unique_ptr<VrShellCommandBufferGl> command_buffer_gl_; |
// Current sizes for the render buffers. |
gvr::Sizei render_size_primary_; |
@@ -179,7 +193,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_; |