Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2445)

Unified Diff: chrome/browser/android/vr_shell/vr_shell_gl.h

Issue 2612333002: Allow VRDisplay to specify which frame the layer bounds should be updated at. (Closed)
Patch Set: rebase Created 3 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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 24ce9627f29d5f2323d00e060f8e370615c26838..e38f8611892a2e53390203f92c8ea68f327dff6c 100644
--- a/chrome/browser/android/vr_shell/vr_shell_gl.h
+++ b/chrome/browser/android/vr_shell/vr_shell_gl.h
@@ -6,6 +6,7 @@
#define CHROME_BROWSER_ANDROID_VR_SHELL_VR_SHELL_GL_H_
#include <memory>
+#include <queue>
#include "base/cancelable_callback.h"
#include "base/macros.h"
@@ -79,7 +80,8 @@ class VrShellGl : public device::mojom::VRVSyncProvider {
void UIPhysicalBoundsChanged(int width, int height);
base::WeakPtr<VrShellGl> GetWeakPtr();
- void UpdateWebVRTextureBounds(const gvr::Rectf& left_bounds,
+ void UpdateWebVRTextureBounds(int16_t frame_index,
+ const gvr::Rectf& left_bounds,
const gvr::Rectf& right_bounds);
gvr::GvrApi* gvr_api();
void SetGvrPoseForWebVr(const gvr::Mat4f& pose, uint32_t pose_num);
@@ -113,7 +115,7 @@ class VrShellGl : public device::mojom::VRVSyncProvider {
void OnUIFrameAvailable();
void OnContentFrameAvailable();
- bool GetPixelEncodedPoseIndexByte(int* pose_index);
+ bool GetPixelEncodedFrameIndex(int* frame_index);
void OnVSync();
@@ -122,7 +124,7 @@ class VrShellGl : public device::mojom::VRVSyncProvider {
void ForceExitVr();
- device::mojom::VRPosePtr GetPose();
+ void SendVSync(const base::TimeDelta& time, GetVSyncCallback callback);
dcheng 2017/01/18 23:58:07 Ditto: pass TimeDelta by value
mthiesse 2017/01/19 01:19:08 Done.
// samplerExternalOES texture data for UI content image.
int ui_texture_id_ = 0;
@@ -147,6 +149,8 @@ class VrShellGl : public device::mojom::VRVSyncProvider {
std::unique_ptr<gvr::BufferViewport> webvr_left_viewport_;
std::unique_ptr<gvr::BufferViewport> webvr_right_viewport_;
std::unique_ptr<gvr::SwapChain> swap_chain_;
+ typedef std::pair<gvr::Rectf, gvr::Rectf> BoundsPair;
+ std::queue<std::pair<uint8_t, BoundsPair>> pending_bounds_;
// Current sizes for the render buffers.
gvr::Sizei render_size_primary_;
@@ -167,10 +171,6 @@ class VrShellGl : public device::mojom::VRVSyncProvider {
gvr::Sizei content_tex_physical_size_ = {0, 0};
gvr::Sizei ui_tex_physical_size_ = {0, 0};
- // The pose ring buffer size must be a power of two to avoid glitches when
- // the pose index wraps around. It should be large enough to handle the
- // current backlog of poses which is 2-3 frames.
- static constexpr int kPoseRingBufferSize = 8;
std::vector<gvr::Mat4f> webvr_head_pose_;
int webvr_texture_id_ = 0;
bool web_vr_mode_;
@@ -196,8 +196,8 @@ class VrShellGl : public device::mojom::VRVSyncProvider {
base::WeakPtr<VrShellDelegate> delegate_provider_;
scoped_refptr<base::SingleThreadTaskRunner> main_thread_task_runner_;
- uint32_t pose_index_ = 1;
- int last_pose_ = 0;
+ uint8_t frame_index_ = 0;
+ int16_t last_frame_index_ = 0;
dcheng 2017/01/18 23:58:07 Some comments here would be helpful. I'm not an ex
mthiesse 2017/01/19 01:19:08 I did this so it could be initialized to -1... and
base::WeakPtrFactory<VrShellGl> weak_ptr_factory_;

Powered by Google App Engine
This is Rietveld 408576698