| Index: third_party/WebKit/Source/modules/webgl/WebGLRenderingContextBase.cpp
|
| diff --git a/third_party/WebKit/Source/modules/webgl/WebGLRenderingContextBase.cpp b/third_party/WebKit/Source/modules/webgl/WebGLRenderingContextBase.cpp
|
| index 010b60b6f884accdd1487866ab9224937604af86..5d6f6db44b08d54fe1830903b7db672327e56760 100644
|
| --- a/third_party/WebKit/Source/modules/webgl/WebGLRenderingContextBase.cpp
|
| +++ b/third_party/WebKit/Source/modules/webgl/WebGLRenderingContextBase.cpp
|
| @@ -25,6 +25,7 @@
|
|
|
| #include "modules/webgl/WebGLRenderingContextBase.h"
|
|
|
| +#include <memory>
|
| #include "bindings/core/v8/ExceptionMessages.h"
|
| #include "bindings/core/v8/ExceptionState.h"
|
| #include "bindings/core/v8/ScriptWrappableVisitor.h"
|
| @@ -47,6 +48,7 @@
|
| #include "core/layout/LayoutBox.h"
|
| #include "core/loader/FrameLoader.h"
|
| #include "core/loader/FrameLoaderClient.h"
|
| +#include "core/origin_trials/OriginTrials.h"
|
| #include "gpu/command_buffer/client/gles2_interface.h"
|
| #include "modules/webgl/ANGLEInstancedArrays.h"
|
| #include "modules/webgl/EXTBlendMinMax.h"
|
| @@ -102,7 +104,6 @@
|
| #include "wtf/text/StringBuilder.h"
|
| #include "wtf/text/StringUTF8Adaptor.h"
|
| #include "wtf/typed_arrays/ArrayBufferContents.h"
|
| -#include <memory>
|
|
|
| namespace blink {
|
|
|
| @@ -624,6 +625,23 @@ WebGLRenderingContextBase::createContextProviderInternal(
|
|
|
| Platform::ContextAttributes contextAttributes =
|
| toPlatformContextAttributes(attributes, webGLVersion);
|
| +
|
| + // If there's a possibility this context may be used with WebVR make sure it
|
| + // is created with an offscreen surface that can be swapped out for a
|
| + // VR-specific surface if needed.
|
| + //
|
| + // At this time, treat this as an experimental rendering optimization
|
| + // that needs a separate opt-in. See crbug.com/691102 for details.
|
| + if (RuntimeEnabledFeatures::webVRExperimentalRenderingEnabled()) {
|
| + if (RuntimeEnabledFeatures::webVREnabled() ||
|
| + OriginTrials::webVREnabled(
|
| + canvas ? canvas->document().getExecutionContext()
|
| + : scriptState->getExecutionContext())) {
|
| + DVLOG(1) << "Requesting supportOwnOffscreenSurface";
|
| + contextAttributes.supportOwnOffscreenSurface = true;
|
| + }
|
| + }
|
| +
|
| Platform::GraphicsInfo glInfo;
|
| std::unique_ptr<WebGraphicsContext3DProvider> contextProvider;
|
| const auto& url = canvas ? canvas->document().topDocument().url()
|
|
|