0

Add a runtime feature for WebXR/WebGPU bindings

This feature also partially overlaps with the WebXRLayers feature, but
we don't want to enable all of that when enabling the WebGPU bindings.
To address that a "WebXRLayersCommon" feature was added that is implied
by either the WebXRGPUBinding feature or the WebXRLayers feature and
which only enables the interfaces that are needed by both features.

Bug: 359418629
Change-Id: Ifff19456a6a8f968dc7064953844ba31052f0be8
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5940998
Commit-Queue: Brandon Jones <bajones@chromium.org>
Reviewed-by: Alexander Cooper <alcooper@chromium.org>
Reviewed-by: Ian Vollick <vollick@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1370731}
This commit is contained in:
Brandon Jones
2024-10-18 18:23:10 +00:00
committed by Chromium LUCI CQ
parent f2fed950d9
commit 43eeeebb15
11 changed files with 26 additions and 9 deletions

@ -315,6 +315,8 @@ void SetRuntimeFeaturesFromChromiumFeatures() {
raw_ref(device::features::kWebXrIncubations)},
{wf::EnableWebXRFrameRate,
raw_ref(device::features::kWebXrIncubations)},
{wf::EnableWebXRGPUBinding,
raw_ref(device::features::kWebXrIncubations)},
{wf::EnableWebXRHandInput,
raw_ref(device::features::kWebXrHandInput)},
{wf::EnableWebXRImageTracking,

@ -14,5 +14,5 @@ dictionary GPURequestAdapterOptions {
GPUPowerPreference powerPreference;
boolean forceFallbackAdapter = false;
[RuntimeEnabled=WebGPUExperimentalFeatures] boolean compatibilityMode = false;
[RuntimeEnabled=WebXRLayers] boolean xrCompatible = false;
[RuntimeEnabled=WebXRGPUBinding] boolean xrCompatible = false;
};

@ -15,7 +15,7 @@ enum XRLayerLayout {
[
SecureContext,
Exposed=Window,
RuntimeEnabled=WebXRLayers
RuntimeEnabled=WebXRLayersCommon
] interface XRCompositionLayer : XRLayer {
readonly attribute XRLayerLayout layout;

@ -12,7 +12,7 @@ dictionary XRGPUProjectionLayerInit {
[
SecureContext,
Exposed=Window,
RuntimeEnabled=WebXRLayers
RuntimeEnabled=WebXRGPUBinding
] interface XRGPUBinding {
[RaisesException] constructor(XRSession session, GPUDevice device);

@ -5,7 +5,7 @@
[
SecureContext,
Exposed=Window,
RuntimeEnabled=WebXRLayers
RuntimeEnabled=WebXRGPUBinding
] interface XRGPUSubImage : XRSubImage {
[SameObject] readonly attribute GPUTexture colorTexture;
[SameObject] readonly attribute GPUTexture? depthStencilTexture;

@ -6,7 +6,7 @@
[
SecureContext,
Exposed=Window,
RuntimeEnabled=WebXRLayers
RuntimeEnabled=WebXRLayersCommon
] interface XRProjectionLayer : XRCompositionLayer {
readonly attribute unsigned long textureWidth;
readonly attribute unsigned long textureHeight;

@ -12,5 +12,5 @@
readonly attribute double depthFar;
readonly attribute double? inlineVerticalFieldOfView;
readonly attribute XRWebGLLayer? baseLayer;
[RuntimeEnabled=WebXRLayers] readonly attribute FrozenArray<XRLayer> layers;
[RuntimeEnabled=WebXRLayersCommon] readonly attribute FrozenArray<XRLayer> layers;
};

@ -8,5 +8,5 @@ dictionary XRRenderStateInit {
double depthFar;
double inlineVerticalFieldOfView;
XRWebGLLayer? baseLayer;
[RuntimeEnabled=WebXRLayers] sequence<XRLayer>? layers;
[RuntimeEnabled=WebXRLayersCommon] sequence<XRLayer>? layers;
};

@ -499,7 +499,7 @@ void XRSession::updateRenderState(XRRenderStateInit* init,
return;
}
if (RuntimeEnabledFeatures::WebXRLayersEnabled() && init->hasLayers() &&
if (RuntimeEnabledFeatures::WebXRLayersCommonEnabled() && init->hasLayers() &&
init->layers() && !init->layers()->empty()) {
// Validate that we don't have both layers and baseLayer set.
if (init->hasBaseLayer() && init->baseLayer()) {

@ -274,8 +274,9 @@ bool IsFeatureEnabledForContext(device::mojom::XRSessionFeature feature,
case device::mojom::XRSessionFeature::HAND_INPUT:
return RuntimeEnabledFeatures::WebXRHandInputEnabled(context);
case device::mojom::XRSessionFeature::LAYERS:
case device::mojom::XRSessionFeature::WEBGPU:
return RuntimeEnabledFeatures::WebXRLayersEnabled(context);
case device::mojom::XRSessionFeature::WEBGPU:
return RuntimeEnabledFeatures::WebXRGPUBindingEnabled(context);
case device::mojom::XRSessionFeature::FRONT_FACING:
return RuntimeEnabledFeatures::WebXRFrontFacingEnabled(context);
case device::mojom::XRSessionFeature::HIT_TEST:

@ -4913,6 +4913,13 @@
status: "experimental",
base_feature: "none",
},
{
name: "WebXRGPUBinding",
depends_on: ["WebXR"],
public: true,
status: "experimental",
base_feature: "none",
},
{
name: "WebXRHandInput",
depends_on: ["WebXR"],
@ -4940,6 +4947,13 @@
status: "experimental",
base_feature: "none",
},
{
name: "WebXRLayersCommon",
implied_by: ["WebXRLayers", "WebXRGPUBinding"],
public: true,
status: "experimental",
base_feature: "none",
},
{
name: "WebXRPlaneDetection",
depends_on: ["WebXR"],