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..436d5d83a6a8d8b185fd453c3f66f2926ba82ee7 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,24 @@ 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. We can only check the origin trial |
+ // if called with a scriptState, not for a canvas. |
amp
2017/02/15 20:04:22
Comment seems out of sync with code which does che
klausw
2017/02/15 20:21:15
Done.
|
+ // |
+ // 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() |