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

Unified Diff: third_party/WebKit/Source/modules/vr/VRDisplay.cpp

Issue 2612333002: Allow VRDisplay to specify which frame the layer bounds should be updated at. (Closed)
Patch Set: Finish implementaion 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: third_party/WebKit/Source/modules/vr/VRDisplay.cpp
diff --git a/third_party/WebKit/Source/modules/vr/VRDisplay.cpp b/third_party/WebKit/Source/modules/vr/VRDisplay.cpp
index eaae511e56a9479733170cc50a4c25655e144898..22148df54ef5c8f7e5a6d91ff250d831e11a1893 100644
--- a/third_party/WebKit/Source/modules/vr/VRDisplay.cpp
+++ b/third_party/WebKit/Source/modules/vr/VRDisplay.cpp
@@ -489,7 +489,8 @@ void VRDisplay::updateLayerBounds() {
m_layer.setRightBounds({0.5f, 0.0f, 0.5f, 1.0f});
}
- m_display->UpdateLayerBounds(std::move(leftBounds), std::move(rightBounds));
+ m_display->UpdateLayerBounds(m_frameId, std::move(leftBounds),
+ std::move(rightBounds));
}
HeapVector<VRLayer> VRDisplay::getLayers() {
@@ -531,6 +532,12 @@ void VRDisplay::submitFrame() {
return;
}
+ // No frame Id to write before submitting the frame.
+ if (m_frameId < 0) {
+ m_display->SubmitFrame(m_framePose.Clone());
+ return;
+ }
+
// Write the frame number for the pose used into a bottom left pixel block.
// It is read by chrome/browser/android/vr_shell/vr_shell.cc to associate
// the correct corresponding pose for submission.
@@ -547,12 +554,12 @@ void VRDisplay::submitFrame() {
// since the final rendering hides the edges via a vignette effect.
gl->Scissor(0, 0, 4, 4);
gl->ColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE);
- int idx = m_framePose->poseIndex;
// Careful with the arithmetic here. Float color 1.f is equivalent to int 255.
// Use the low byte of the index as the red component, and store an arbitrary
// magic number in green/blue. This number must match the reading code in
// vr_shell.cc. Avoid all-black/all-white.
- gl->ClearColor((idx & 255) / 255.0f, kWebVrPosePixelMagicNumbers[0] / 255.0f,
+ gl->ClearColor((m_frameId & 255) / 255.0f,
+ kWebVrPosePixelMagicNumbers[0] / 255.0f,
kWebVrPosePixelMagicNumbers[1] / 255.0f, 1.0f);
gl->Clear(GL_COLOR_BUFFER_BIT);
@@ -608,7 +615,8 @@ void VRDisplay::OnDeactivate(
}
void VRDisplay::OnVSync(device::mojom::blink::VRPosePtr pose,
- double timeSeconds) {
+ double timeSeconds,
+ int16_t frameId) {
if (m_vrVSyncProvider.is_bound()) {
m_vrVSyncProvider->GetVSync(convertToBaseCallback(
WTF::bind(&VRDisplay::OnVSync, wrapWeakPersistent(this))));
@@ -632,6 +640,7 @@ void VRDisplay::OnVSync(device::mojom::blink::VRPosePtr pose,
AutoReset<bool> animating(&m_inAnimationFrame, true);
m_framePose = std::move(pose);
+ m_frameId = frameId;
m_scriptedAnimationController->serviceScriptedAnimations(m_timebase +
timeSeconds);
}

Powered by Google App Engine
This is Rietveld 408576698