-
Notifications
You must be signed in to change notification settings - Fork 387
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Expose a way to query a session about the supported features - need to reconsider? #1205
Comments
+1 on that |
Yeah, I agree, and when I was adding that field it was with the hope that we might expose it at some point. |
Strawperson proposal: enum XRFeature {
"local",
"local-floor",
...
};
interface XRFeatureSet {
// Alternatively, this could be a DOMString, or any.
readonly setlike<XRFeature>;
};
partial interface XRSession {
// Probably should not be [SameObject] if we want to allow enabling features post-session-creation.
// Alternatively, FrozenArray (which would make it impossible to make it a [SameObject] IIUC).
readonly attribute XRFeatureSet enabledFeatures;
}; I don't think there's a big difference between an enum vs Naming TBD, I went with As for the attribute type, I think we should be returning something that's setlike as the main use case for the apps would be to check whether a specific feature was enabled, and this boils down to As for semantics, I'd propose that all enabled features are returned (including the required ones). I think this would make the app logic simpler ("to check whether a feature is enabled, I check if it's in XRSession.enabledFeatures" vs "to check whether a feature is enabled, if it was optional, I check if it's in XRSession.enabledFeatures, otherwise it's enabled because I wouldn't have gotten a session"). As a bonus, the spec text becomes simpler since we'd just need to expose the session's set of granted features to the app. LMK if this looks reasonable, I can issue a PR if so. |
Should we just return a set directly? I guess it could get more complex for cases of non-stringy descriptors. |
Another thing to consider: can a feature become available/unavailable during session life? E.g. physical disconnect of hardware, or permissions change, etc? |
I'm not sure if this is doable in Web IDL - what type to put in Web IDL to signify that the result is a Set?.. As for the non-stringy descriptors - do you have some context on them? I see we have specced that feature descriptor can be
Currently, I believe it's not possible, but I've seen discussions that we may want to be able to allow that, e.g. because an app could ask for more features after the session was created. If we ever allow it, we'll need to be certain to spec it so that UAs can still disallow it - I know there are some AR session features can only be enabled at session creation in our implementation. |
/agenda |
Did we discuss this issue 2 weeks ago? If so does it still need discussing? |
We discussed it but we didn't ask anyone to work on it so nothing happened :-) |
I've got some time and was looking at writing up the spec change for this. From looking here and at the minutes; it's not clear how/if people felt strongly about:
Does anyone have some thoughts here before I take a stab at a draft? I don't know that these needs to be discussed in a meeting since it seems we had general agreement about doing this in the past; but if I don't get any responses (or anyone would prefer to discuss it there), I'll add it to the agenda. |
It sounds like you already spent a good time thinking this through. It'd be great if you could create a draft proposal that we can discuss in a meeting. |
/agenda to discuss the PR above We can remove it from the agenda if we feel okay to merge it before then. |
Closing since PR #1296 fixed this |
The initial landing of GPURequestAdapterOptions.featureLevel allowed `any` because we don't know what the shape of future feature level requests will be. Brandon pointed out that we don't need to use `any` to achieve this. Instead, we can add sibling members such that you request something like: `{ featureLevel: 'foo', fooOptions: { /* ... */ } }` There was a similar change in WebXR's history; discussion on that seems to start roughly here: immersive-web/webxr#1205 (comment) (It is a DOMString rather than an enum so that we can return `null` meaning "cannot fulfill adapter request" rather than rejecting. This makes it consistent between older browsers, and newer browsers on older hardware.) Issue: 4656
The initial landing of GPURequestAdapterOptions.featureLevel allowed `any` because we don't know what the shape of future feature level requests will be. Brandon pointed out that we don't need to use `any` to achieve this. Instead, we can add sibling members such that you request something like: `{ featureLevel: 'foo', featureLevelFooOptions: { /* ... */ } }` There was a similar change in WebXR's history; discussion on that seems to start roughly here: immersive-web/webxr#1205 (comment) (It is a DOMString rather than an enum so that we can return `null` meaning "cannot fulfill adapter request" rather than rejecting. This makes it consistent between older browsers, and newer browsers on older hardware.) Issue: 4656
The initial landing of GPURequestAdapterOptions.featureLevel allowed `any` because we don't know what the shape of future feature level requests will be. Brandon pointed out that we don't need to use `any` to achieve this. Instead, we can add sibling members such that you request something like: `{ featureLevel: 'foo', featureLevelFooOptions: { /* ... */ } }` There was a similar change in WebXR's history; discussion on that seems to start roughly here: immersive-web/webxr#1205 (comment) (It is a DOMString rather than an enum so that we can return `null` meaning "cannot fulfill adapter request" rather than rejecting. This makes it consistent between older browsers, and newer browsers on older hardware.) Issue: 4656
I do not seem to be able to reopen the original issue (#952), so filing a new one now that we have independent sets of enabled features on an XR device & on an XRSession.
If my read of the spec is correct, the Permissions API will only return permission status for the device features (which may be persistent across sessions and do not really say anything about the state of the session), so the apps have no way of observing the contents of XRSession's set of enabled features.
My preferred way to solve this would be extending the
XRSession
to expose a set of enabled features. Spec-wise, it seems it could be achieved by turning the not-IDL-exposedXRSession/set of enabled features
into an IDL-exposed attribute.XRSession.enabledFeatures
of typeset<DOMString>
(orset<any>
, although I'm not sure whyDOMString
wouldn't be sufficient here).Related issues:
immersive-web/real-world-geometry#30
immersive-web/anchors#64
The text was updated successfully, but these errors were encountered: