webxr: Add some missing internal checks/validation (#33318)

* Ensure depthFar is non-negative

Signed-off-by: Daniel Adams <msub2official@gmail.com>

* Properly append default features in requestSession

Signed-off-by: Daniel Adams <msub2official@gmail.com>

* Ensure XRRigidTransform init members have finite values

Signed-off-by: Daniel Adams <msub2official@gmail.com>

---------

Signed-off-by: Daniel Adams <msub2official@gmail.com>
This commit is contained in:
Daniel Adams 2024-09-05 03:39:27 +00:00 committed by GitHub
parent aadc212b95
commit 75c7712905
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
9 changed files with 35 additions and 40 deletions

View file

@ -709,11 +709,16 @@ impl XRSessionMethods for XRSession {
pending.set_depth_near(near);
}
if let Some(far) = init.depthFar {
let mut far = *far;
// Step 9 from #apply-the-pending-render-state
// this may need to be changed if backends wish to impose
// further constraints
// currently the maximum is infinity, so we do nothing
pending.set_depth_far(*far);
// currently the maximum is infinity, so just check that
// the value is non-negative
if far < 0. {
far = 0.;
}
pending.set_depth_far(far);
}
if let Some(fov) = init.inlineVerticalFieldOfView {
let mut fov = *fov;