зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1640912 - Update xrCompatible flag when WebGLContext::makeXRCompatible call succeeds r=jgilbert,kip,daoshengmu
Currently WebGL xrCompatible flag is only set when enabling the xrCompatible attribute in the canvas.getContext() call. We also need to set it to true after succesful makeXRCompatible() calls Differential Revision: https://phabricator.services.mozilla.com/D76849
This commit is contained in:
Родитель
3e4c61adb7
Коммит
201362531f
|
@ -907,6 +907,8 @@ ClientWebGLContext::SetContextOptions(JSContext* cx,
|
|||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
mXRCompatible = attributes.mXrCompatible;
|
||||
|
||||
mInitialOptions.emplace(newOpts);
|
||||
return NS_OK;
|
||||
}
|
||||
|
|
|
@ -2178,6 +2178,7 @@ class ClientWebGLContext final : public nsICanvasRenderingContextInternal,
|
|||
bool mResetLayer = true;
|
||||
Maybe<const WebGLContextOptions> mInitialOptions;
|
||||
WebGLPixelStore mPixelStore;
|
||||
bool mXRCompatible = false;
|
||||
};
|
||||
|
||||
// used by DOM bindings in conjunction with GetParentObject
|
||||
|
|
|
@ -1787,11 +1787,7 @@ WebGLContext::FuncScope::~FuncScope() {
|
|||
|
||||
// --
|
||||
|
||||
bool ClientWebGLContext::IsXRCompatible() const {
|
||||
if (!mNotLost) return false;
|
||||
const auto& options = mNotLost->info.options;
|
||||
return options.xrCompatible;
|
||||
}
|
||||
bool ClientWebGLContext::IsXRCompatible() const { return mXRCompatible; }
|
||||
|
||||
already_AddRefed<dom::Promise> ClientWebGLContext::MakeXRCompatible(
|
||||
ErrorResult& aRv) {
|
||||
|
@ -1823,7 +1819,7 @@ already_AddRefed<dom::Promise> ClientWebGLContext::MakeXRCompatible(
|
|||
// TODO: Bug 1580258 - WebGLContext.MakeXRCompatible needs to switch to
|
||||
// the device connected to the XR hardware
|
||||
// This should update `options` and lose+restore the context.
|
||||
|
||||
mXRCompatible = true;
|
||||
promise->MaybeResolveWithUndefined();
|
||||
return promise.forget();
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче