Commit 1d9390ab authored by Piotr Bialecki's avatar Piotr Bialecki Committed by Commit Bot

WebXR - AR - propagate session options to ArCoreGl

ArCoreGl (roughly corresponding to an immersive-ar session) currently
does not receive requested features list. The list will eventually be
needed to remove the assumption in blink about world space being
equivalent to local space (or sometimes unbounded, see [0]).

[0] https://source.chromium.org/chromium/chromium/src/+/master:third_party/blink/renderer/modules/xr/xr_reference_space.cc;l=112

Bug: 953503
Change-Id: I5b7773b83d1c9cdac4de7f8f4635da69d607c91f
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2140952Reviewed-by: default avatarKlaus Weidner <klausw@chromium.org>
Commit-Queue: Piotr Bialecki <bialpio@chromium.org>
Cr-Commit-Position: refs/heads/master@{#781903}
parent bbeeec98
...@@ -126,6 +126,7 @@ void ArCoreDevice::RequestSession( ...@@ -126,6 +126,7 @@ void ArCoreDevice::RequestSession(
DCHECK(!session_state_->pending_request_session_callback_); DCHECK(!session_state_->pending_request_session_callback_);
session_state_->pending_request_session_callback_ = std::move(callback); session_state_->pending_request_session_callback_ = std::move(callback);
session_state_->enabled_features_ = options->enabled_features;
bool use_dom_overlay = base::Contains( bool use_dom_overlay = base::Contains(
options->enabled_features, device::mojom::XRSessionFeature::DOM_OVERLAY); options->enabled_features, device::mojom::XRSessionFeature::DOM_OVERLAY);
...@@ -335,7 +336,7 @@ void ArCoreDevice::RequestArCoreGlInitialization( ...@@ -335,7 +336,7 @@ void ArCoreDevice::RequestArCoreGlInitialization(
&ArCoreGl::Initialize, &ArCoreGl::Initialize,
session_state_->arcore_gl_thread_->GetArCoreGl()->GetWeakPtr(), session_state_->arcore_gl_thread_->GetArCoreGl()->GetWeakPtr(),
arcore_session_utils_.get(), arcore_factory_.get(), drawing_widget, arcore_session_utils_.get(), arcore_factory_.get(), drawing_widget,
frame_size, rotation, frame_size, rotation, session_state_->enabled_features_,
CreateMainThreadCallback(base::BindOnce( CreateMainThreadCallback(base::BindOnce(
&ArCoreDevice::OnArCoreGlInitializationComplete, GetWeakPtr())))); &ArCoreDevice::OnArCoreGlInitializationComplete, GetWeakPtr()))));
return; return;
......
...@@ -129,6 +129,9 @@ class ArCoreDevice : public VRDeviceBase { ...@@ -129,6 +129,9 @@ class ArCoreDevice : public VRDeviceBase {
// the callback for replying once that initialization completes. Only one // the callback for replying once that initialization completes. Only one
// concurrent session is supported, other requests are rejected. // concurrent session is supported, other requests are rejected.
mojom::XRRuntime::RequestSessionCallback pending_request_session_callback_; mojom::XRRuntime::RequestSessionCallback pending_request_session_callback_;
// List of features that are enabled on the session.
std::vector<device::mojom::XRSessionFeature> enabled_features_;
}; };
// This object is reset to initial values when ending a session. This helps // This object is reset to initial values when ending a session. This helps
......
...@@ -124,12 +124,14 @@ ArCoreGl::~ArCoreGl() { ...@@ -124,12 +124,14 @@ ArCoreGl::~ArCoreGl() {
CloseBindingsIfOpen(); CloseBindingsIfOpen();
} }
void ArCoreGl::Initialize(vr::ArCoreSessionUtils* session_utils, void ArCoreGl::Initialize(
ArCoreFactory* arcore_factory, vr::ArCoreSessionUtils* session_utils,
gfx::AcceleratedWidget drawing_widget, ArCoreFactory* arcore_factory,
const gfx::Size& frame_size, gfx::AcceleratedWidget drawing_widget,
display::Display::Rotation display_rotation, const gfx::Size& frame_size,
base::OnceCallback<void(bool)> callback) { display::Display::Rotation display_rotation,
const std::vector<device::mojom::XRSessionFeature>& enabled_features,
base::OnceCallback<void(bool)> callback) {
DVLOG(3) << __func__; DVLOG(3) << __func__;
DCHECK(IsOnGlThread()); DCHECK(IsOnGlThread());
...@@ -138,6 +140,9 @@ void ArCoreGl::Initialize(vr::ArCoreSessionUtils* session_utils, ...@@ -138,6 +140,9 @@ void ArCoreGl::Initialize(vr::ArCoreSessionUtils* session_utils,
transfer_size_ = frame_size; transfer_size_ = frame_size;
camera_image_size_ = frame_size; camera_image_size_ = frame_size;
display_rotation_ = display_rotation; display_rotation_ = display_rotation;
// TODO(https://crbug.com/953503): start using the list to control the
// behavior & send appropriate data in GetFrameData().
enabled_features_ = enabled_features;
should_update_display_geometry_ = true; should_update_display_geometry_ = true;
if (!InitializeGl(drawing_widget)) { if (!InitializeGl(drawing_widget)) {
......
...@@ -67,12 +67,14 @@ class ArCoreGl : public mojom::XRFrameDataProvider, ...@@ -67,12 +67,14 @@ class ArCoreGl : public mojom::XRFrameDataProvider,
explicit ArCoreGl(std::unique_ptr<ArImageTransport> ar_image_transport); explicit ArCoreGl(std::unique_ptr<ArImageTransport> ar_image_transport);
~ArCoreGl() override; ~ArCoreGl() override;
void Initialize(vr::ArCoreSessionUtils* session_utils, void Initialize(
ArCoreFactory* arcore_factory, vr::ArCoreSessionUtils* session_utils,
gfx::AcceleratedWidget drawing_widget, ArCoreFactory* arcore_factory,
const gfx::Size& frame_size, gfx::AcceleratedWidget drawing_widget,
display::Display::Rotation display_rotation, const gfx::Size& frame_size,
base::OnceCallback<void(bool)> callback); display::Display::Rotation display_rotation,
const std::vector<device::mojom::XRSessionFeature>& enabled_features,
base::OnceCallback<void(bool)> callback);
void CreateSession(mojom::VRDisplayInfoPtr display_info, void CreateSession(mojom::VRDisplayInfoPtr display_info,
ArCoreGlCreateSessionCallback create_callback, ArCoreGlCreateSessionCallback create_callback,
...@@ -179,6 +181,11 @@ class ArCoreGl : public mojom::XRFrameDataProvider, ...@@ -179,6 +181,11 @@ class ArCoreGl : public mojom::XRFrameDataProvider,
// state on session shutdown. See https://crbug.com/1065572. // state on session shutdown. See https://crbug.com/1065572.
void RunNextGetFrameData(); void RunNextGetFrameData();
// List of features enabled on this session. Required to correctly configure
// the session and only send out necessary data related to reference spaces to
// blink. Valid after the call to |Initialize()| method.
std::vector<device::mojom::XRSessionFeature> enabled_features_;
base::OnceClosure session_shutdown_callback_; base::OnceClosure session_shutdown_callback_;
scoped_refptr<gl::GLSurface> surface_; scoped_refptr<gl::GLSurface> surface_;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment