Skip to content

Commit b577650

Browse files
Use 0.4 for depth unorm value in depth_compare_func rendering test (#4374)
This PR make depth_compare_func rendering operation test use 0.4 for depth unrom value instead of 0.5001, which is exactly representable in both depth16unorm and depth24unorm, and closely approximated in depth32float. This can help prevent shaders and depthClearValue get rounded in different way, and make Qualcomm devices pass the test when using DXGI_FORMAT_D24_UNORM_S8_UINT format for depth24plus-stencil8. * Update src/webgpu/api/operation/rendering/depth.spec.ts Co-authored-by: Kai Ninomiya <[email protected]> --------- Co-authored-by: Kai Ninomiya <[email protected]>
1 parent 64b4dfc commit b577650

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

src/webgpu/api/operation/rendering/depth.spec.ts

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -289,9 +289,12 @@ g.test('depth_test_fail')
289289
t.runDepthStateTest(testStates, _expectedColor);
290290
});
291291

292-
// Use a depth value that's not exactly 0.5 because it is exactly between two depth16unorm value and
293-
// can get rounded either way (and a different way between shaders and clearDepthValue).
294-
const kMiddleDepthValue = 0.5001;
292+
// Use a depth value of 0.4, which is exactly representable in depth16unorm (26214 / (2^16-1))
293+
// and depth24unorm (6710886 / (2^24-1)), and closely approximated in depth32float
294+
// (0.4000000059604644775390625).
295+
// This can help prevent shaders and depthClearValue get rounded in different way making equal
296+
// comparison result unexpected.
297+
const kMiddleDepthValue = 0.4;
295298

296299
g.test('depth_compare_func')
297300
.desc(

0 commit comments

Comments
 (0)