Commit a71eaca1 authored by Alexander Cooper's avatar Alexander Cooper Committed by Commit Bot

Update Lighting Estimation interfaces to match new versions

Updates the WebXR LightingEstimation interfaces to account for changes
that allow requesting the ReflectionMap texture in different forms.

Note that the actual conversion/consumption of this will be added in a
future change. For now, XRLightProbeInit is ignored and all textures
returned are rgba16f.

Bug: 1070819
Change-Id: Ib9e9f6f2cff6af867eda00119380434a232d69a0
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2527363Reviewed-by: default avatarKlaus Weidner <klausw@chromium.org>
Reviewed-by: default avatarBrandon Jones <bajones@chromium.org>
Commit-Queue: Alexander Cooper <alcooper@chromium.org>
Cr-Commit-Position: refs/heads/master@{#825927}
parent 0ab6244f
......@@ -993,6 +993,7 @@ static_idl_files_in_modules = get_path_info(
"//third_party/blink/renderer/modules/xr/xr_layer.idl",
"//third_party/blink/renderer/modules/xr/xr_light_estimate.idl",
"//third_party/blink/renderer/modules/xr/xr_light_probe.idl",
"//third_party/blink/renderer/modules/xr/xr_light_probe_init.idl",
"//third_party/blink/renderer/modules/xr/xr_plane.idl",
"//third_party/blink/renderer/modules/xr/xr_plane_detection_state.idl",
"//third_party/blink/renderer/modules/xr/xr_plane_set.idl",
......
......@@ -52,6 +52,7 @@ modules_dictionary_idl_files = [
"xr_hit_test_options_init.idl",
"xr_input_source_event_init.idl",
"xr_input_sources_change_event_init.idl",
"xr_light_probe_init.idl",
"xr_ray_direction_init.idl",
"xr_reference_space_event_init.idl",
"xr_render_state_init.idl",
......
// Copyright 2020 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// https://immersive-web.github.io/lighting-estimation/#dictdef-xrlightprobeinit
dictionary XRLightProbeInit {
XRReflectionFormat reflectionFormat = "srgba8";
};
......@@ -1244,6 +1244,7 @@ XRDepthInformation* XRSession::GetDepthInformation() const {
}
ScriptPromise XRSession::requestLightProbe(ScriptState* script_state,
XRLightProbeInit* light_probe_init,
ExceptionState& exception_state) {
if (ended_) {
exception_state.ThrowDOMException(DOMExceptionCode::kInvalidStateError,
......
......@@ -10,6 +10,7 @@
#include "mojo/public/cpp/bindings/pending_associated_remote.h"
#include "mojo/public/cpp/bindings/remote.h"
#include "third_party/blink/renderer/bindings/core/v8/script_promise.h"
#include "third_party/blink/renderer/bindings/modules/v8/v8_xr_light_probe_init.h"
#include "third_party/blink/renderer/core/dom/events/event_target.h"
#include "third_party/blink/renderer/core/html/html_element.h"
#include "third_party/blink/renderer/core/typed_arrays/array_buffer_view_helpers.h"
......@@ -123,6 +124,11 @@ class XRSession final
XRRenderState* renderState() const { return render_state_; }
XRWorldTrackingState* worldTrackingState() { return world_tracking_state_; }
// ARCore by default returns textures in RGBA half-float HDR format and no
// other runtimes support reflection mapping, so just return this until we
// have a need to differentiate based on the underlying runtime.
const String preferredReflectionFormat() const { return "rgba16f"; }
XRSpace* viewerSpace() const;
XRAnchorSet* TrackedAnchors() const;
......@@ -199,7 +205,9 @@ class XRSession final
XRTransientInputHitTestOptionsInit* options_init,
ExceptionState& exception_state);
ScriptPromise requestLightProbe(ScriptState* script_state, ExceptionState&);
ScriptPromise requestLightProbe(ScriptState* script_state,
XRLightProbeInit*,
ExceptionState&);
ScriptPromise getTrackedImageScores(ScriptState* script_state,
ExceptionState&);
......
......@@ -32,6 +32,11 @@ enum XRImageTrackingScore {
"trackable",
};
enum XRReflectionFormat {
"srgba8",
"rgba16f",
};
[
ActiveScriptWrappable,
SecureContext,
......@@ -44,6 +49,7 @@ enum XRImageTrackingScore {
[SameObject] readonly attribute XRRenderState renderState;
[CallWith=ScriptState, MeasureAs=XRSessionGetInputSources, SameObject] readonly attribute XRInputSourceArray inputSources;
[SameObject] readonly attribute XRDOMOverlayState domOverlayState;
[RuntimeEnabled=WebXRLightEstimation] readonly attribute XRReflectionFormat preferredReflectionFormat;
attribute EventHandler onend;
attribute EventHandler onselect;
......@@ -74,7 +80,7 @@ enum XRImageTrackingScore {
Promise<XRTransientInputHitTestSource> requestHitTestSourceForTransientInput(XRTransientInputHitTestOptionsInit options);
[RuntimeEnabled=WebXRLightEstimation, CallWith=ScriptState, RaisesException]
Promise<XRLightProbe> requestLightProbe();
Promise<XRLightProbe> requestLightProbe(optional XRLightProbeInit options = {});
[RuntimeEnabled=WebXRImageTracking, CallWith=ScriptState, RaisesException]
Promise<FrozenArray<XRImageTrackingScore>> getTrackedImageScores();
......
......@@ -10550,6 +10550,7 @@ interface XRSession : EventTarget
getter onsqueezeend
getter onsqueezestart
getter onvisibilitychange
getter preferredReflectionFormat
getter renderState
getter visibilityState
getter worldTrackingState
......
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