| Index: chrome/browser/android/vr_shell/vr_shell_gl.cc
|
| diff --git a/chrome/browser/android/vr_shell/vr_shell_gl.cc b/chrome/browser/android/vr_shell/vr_shell_gl.cc
|
| index ae068e4e7b93bc407e1298cacfd1f800272a4653..b7d91a51b93a88f756fd1bbe3cf557e6b6334253 100644
|
| --- a/chrome/browser/android/vr_shell/vr_shell_gl.cc
|
| +++ b/chrome/browser/android/vr_shell/vr_shell_gl.cc
|
| @@ -359,6 +359,7 @@ void VrShellGl::InitializeRenderer() {
|
| // For kFramePrimaryBuffer (primary VrShell and WebVR content)
|
| specs.push_back(gvr_api_->CreateBufferSpec());
|
| render_size_primary_ = specs[kFramePrimaryBuffer].GetSize();
|
| + render_size_primary_vrshell_ = render_size_primary_;
|
|
|
| // For kFrameHeadlockedBuffer (for WebVR insecure content warning).
|
| // Set this up at fixed resolution, the (smaller) FOV gets set below.
|
| @@ -638,6 +639,27 @@ void VrShellGl::DrawFrame() {
|
| // DrawVrShell if needed.
|
| buffer_viewport_list_->SetToRecommendedBufferViewports();
|
|
|
| + // Resize render buffers to match desired resolution when switching
|
| + // modes between WebVR and VrShell mode.
|
| + if (web_vr_mode_) {
|
| + // If needed, resize the primary buffer for use with WebVR so that
|
| + // it matches the canvas size used for WebGL rendering.
|
| + if (render_size_primary_ != render_size_primary_webvr_) {
|
| + if (!render_size_primary_webvr_.width) {
|
| + DVLOG(2) << "WebVR rendering size not known yet, dropping frame";
|
| + return;
|
| + }
|
| + render_size_primary_ = render_size_primary_webvr_;
|
| + swap_chain_->ResizeBuffer(kFramePrimaryBuffer, render_size_primary_);
|
| + }
|
| + } else {
|
| + // Restore high resolution for VrShell mode.
|
| + if (render_size_primary_ != render_size_primary_vrshell_) {
|
| + render_size_primary_ = render_size_primary_vrshell_;
|
| + swap_chain_->ResizeBuffer(kFramePrimaryBuffer, render_size_primary_);
|
| + }
|
| + }
|
| +
|
| gvr::Frame frame = swap_chain_->AcquireFrame();
|
| if (!frame.is_valid()) {
|
| return;
|
| @@ -1049,6 +1071,8 @@ void VrShellGl::ContentPhysicalBoundsChanged(int width, int height) {
|
| content_surface_texture_->SetDefaultBufferSize(width, height);
|
| content_tex_physical_size_.width = width;
|
| content_tex_physical_size_.height = height;
|
| + render_size_primary_webvr_.width = width;
|
| + render_size_primary_webvr_.height = height;
|
| }
|
|
|
| void VrShellGl::UIBoundsChanged(int width, int height) {
|
|
|