| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "chrome/browser/android/vr_shell/vr_shell_gl.h" | 5 #include "chrome/browser/android/vr_shell/vr_shell_gl.h" |
| 6 | 6 |
| 7 #include <chrono> | 7 #include <chrono> |
| 8 #include <limits> | 8 #include <limits> |
| 9 #include <utility> | 9 #include <utility> |
| 10 | 10 |
| (...skipping 259 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 270 surface_ = gl::init::CreateViewGLSurface(window); | 270 surface_ = gl::init::CreateViewGLSurface(window); |
| 271 } else { | 271 } else { |
| 272 CHECK(surfaceless_rendering_); | 272 CHECK(surfaceless_rendering_); |
| 273 surface_ = gl::init::CreateOffscreenGLSurface(gfx::Size()); | 273 surface_ = gl::init::CreateOffscreenGLSurface(gfx::Size()); |
| 274 } | 274 } |
| 275 if (!surface_.get()) { | 275 if (!surface_.get()) { |
| 276 LOG(ERROR) << "gl::init::CreateOffscreenGLSurface failed"; | 276 LOG(ERROR) << "gl::init::CreateOffscreenGLSurface failed"; |
| 277 ForceExitVr(); | 277 ForceExitVr(); |
| 278 return; | 278 return; |
| 279 } | 279 } |
| 280 context_ = gl::init::CreateGLContext(nullptr, surface_.get(), | 280 |
| 281 gl::GLContextAttribs()); | 281 gl::GLContextAttribs attribs; |
| 282 attribs.context_priority = gl::ContextPriorityHigh; |
| 283 context_ = gl::init::CreateGLContext(nullptr, surface_.get(), attribs); |
| 282 if (!context_.get()) { | 284 if (!context_.get()) { |
| 283 LOG(ERROR) << "gl::init::CreateGLContext failed"; | 285 LOG(ERROR) << "gl::init::CreateGLContext failed"; |
| 284 ForceExitVr(); | 286 ForceExitVr(); |
| 285 return; | 287 return; |
| 286 } | 288 } |
| 287 if (!context_->MakeCurrent(surface_.get())) { | 289 if (!context_->MakeCurrent(surface_.get())) { |
| 288 LOG(ERROR) << "gl::GLContext::MakeCurrent() failed"; | 290 LOG(ERROR) << "gl::GLContext::MakeCurrent() failed"; |
| 289 ForceExitVr(); | 291 ForceExitVr(); |
| 290 return; | 292 return; |
| 291 } | 293 } |
| (...skipping 1247 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1539 // This assumes that the initial webvr_surface_size_ was set to the | 1541 // This assumes that the initial webvr_surface_size_ was set to the |
| 1540 // appropriate recommended render resolution as the default size during | 1542 // appropriate recommended render resolution as the default size during |
| 1541 // InitializeGl. Revisit if the initialization order changes. | 1543 // InitializeGl. Revisit if the initialization order changes. |
| 1542 device::mojom::VRDisplayInfoPtr info = | 1544 device::mojom::VRDisplayInfoPtr info = |
| 1543 device::GvrDelegate::CreateVRDisplayInfo(gvr_api_.get(), | 1545 device::GvrDelegate::CreateVRDisplayInfo(gvr_api_.get(), |
| 1544 webvr_surface_size_, device_id); | 1546 webvr_surface_size_, device_id); |
| 1545 browser_->RunVRDisplayInfoCallback(callback, &info); | 1547 browser_->RunVRDisplayInfoCallback(callback, &info); |
| 1546 } | 1548 } |
| 1547 | 1549 |
| 1548 } // namespace vr_shell | 1550 } // namespace vr_shell |
| OLD | NEW |