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

Unified Diff: third_party/WebKit/Source/modules/webgl/WebGLRenderingContextBase.cpp

Issue 2586803003: Enable creation of offscreen contexts which own their backing surface. (Closed)
Patch Set: Rebase, update comment for alpha semantics 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/webgl/WebGLRenderingContextBase.cpp
diff --git a/third_party/WebKit/Source/modules/webgl/WebGLRenderingContextBase.cpp b/third_party/WebKit/Source/modules/webgl/WebGLRenderingContextBase.cpp
index 51e311d30217cd72e6429c1d5349f38924243d84..65f36d4407b61b56f0c3d4b08e031244bfa1b04e 100644
--- a/third_party/WebKit/Source/modules/webgl/WebGLRenderingContextBase.cpp
+++ b/third_party/WebKit/Source/modules/webgl/WebGLRenderingContextBase.cpp
@@ -46,6 +46,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"
@@ -623,6 +624,17 @@ 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.
+ if (RuntimeEnabledFeatures::webVREnabled() ||
+ (scriptState &&
+ OriginTrials::webVREnabled(scriptState->getExecutionContext()))) {
+ contextAttributes.supportOwnOffscreenSurface = true;
+ }
+
Platform::GraphicsInfo glInfo;
std::unique_ptr<WebGraphicsContext3DProvider> contextProvider;
const auto& url = canvas ? canvas->document().topDocument().url()

Powered by Google App Engine
This is Rietveld 408576698