Bug 1873958 [wpt PR 43924] - [WebXR] Implement clipping planes clamping, a=testonly

Automatic update from web-platform-tests
[WebXR] Implement clipping planes clamping

The WebXR specs specify[1] that user agents should enforce a minimum near clip plane and a maximum far clip plane. In particular they
must not be negative.

[1] https://immersive-web.github.io/webxr/#minimum-near-clip-plane

WPT test

Change-Id: Ib9c7dbbd524d24e657ea85f9bb9208bfc80a6aef
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5185618
Commit-Queue: Sergio Villar <svillar@igalia.com>
Reviewed-by: Alexander Cooper <alcooper@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1252767}

--

wpt-commits: 014486aedc1ca357b9409ca9ef7a0dfd32e30258
wpt-pr: 43924
This commit is contained in:
Sergio Villar Senin 2024-01-28 22:00:55 +00:00 коммит произвёл moz-wptsync-bot
Родитель bf170271c2
Коммит 69bee95b26
1 изменённых файлов: 37 добавлений и 0 удалений

Просмотреть файл

@ -77,6 +77,40 @@ let testParams = function(session, fakeDeviceController, t, sessionObjects) {
}); });
}; };
let testMinMaxClippingPlanes = function(session, fakeDeviceController, t, sessionObjects) {
return new Promise((resolve, reject) => {
let gl = sessionObjects.gl;
gl.makeXRCompatible().then(() => {
t.step(() => {
let near = 0.2;
let far = 0.8;
let layer = new XRWebGLLayer(session, gl);
session.updateRenderState({ depthNear: near, depthFar: far, baseLayer: layer });
assert_not_equals(session.renderState.depthNear, near);
assert_not_equals(session.renderState.depthFar, far);
assert_not_equals(session.renderState.baseLayer, layer);
session.requestAnimationFrame((time, xrFrame) => {
t.step(() => {
assert_equals(session.renderState.depthNear, near);
assert_equals(session.renderState.depthFar, far);
// Clamp negative values
near = -20.3;
far = -1.5;
session.updateRenderState({ depthNear: near, depthFar: far });
session.requestAnimationFrame((time, xrFrame) => {
t.step(() => {
assert_equals(session.renderState.depthNear, 0.0);
assert_equals(session.renderState.depthFar, 0.0);
resolve();
});
});
});
});
});
});
});
};
let testName = "updateRenderState handles appropriately ended sessions"; let testName = "updateRenderState handles appropriately ended sessions";
xr_session_promise_test(testName, testSessionEnded, fakeDeviceInitParams, 'immersive-vr'); xr_session_promise_test(testName, testSessionEnded, fakeDeviceInitParams, 'immersive-vr');
@ -92,4 +126,7 @@ xr_session_promise_test(testName, testNoParams, fakeDeviceInitParams, 'immersive
testName = "updateRenderState handles appropriately XRRenderStateInit params"; testName = "updateRenderState handles appropriately XRRenderStateInit params";
xr_session_promise_test(testName, testParams, fakeDeviceInitParams, 'inline'); xr_session_promise_test(testName, testParams, fakeDeviceInitParams, 'inline');
testName = "updateRenderState clamps appropriately near/far clipping planes";
xr_session_promise_test(testName, testMinMaxClippingPlanes, fakeDeviceInitParams, 'immersive-vr');
</script> </script>