Skip to content

Commit 6dffd78

Browse files
authored
Adjust maxFractionalDiff for canvas color-space-conversion (#4486)
This was failing for rg11b10ufloat which is new. Rather than increase the tolerance for all formats, set it specifically for certain formats.
1 parent eefe6f3 commit 6dffd78

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

src/webgpu/web_platform/copyToTexture/canvas.spec.ts

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -836,8 +836,15 @@ g.test('color_space_conversion')
836836
maxDiffULPsForNormFormat: 1,
837837
};
838838
if (srcColorSpace !== dstColorSpace) {
839-
// Color space conversion seems prone to errors up to about 0.0003 on f32, 0.0007 on f16.
840-
texelCompareOptions.maxFractionalDiff = 0.001;
839+
if (dstColorFormat.endsWith('32float')) {
840+
texelCompareOptions.maxFractionalDiff = 0.0003;
841+
} else if (dstColorFormat.endsWith('16float')) {
842+
texelCompareOptions.maxFractionalDiff = 0.0007;
843+
} else if (dstColorFormat === 'rg11b10ufloat') {
844+
texelCompareOptions.maxFractionalDiff = 0.015;
845+
} else {
846+
texelCompareOptions.maxFractionalDiff = 0.001;
847+
}
841848
} else {
842849
texelCompareOptions.maxDiffULPsForFloatFormat = 1;
843850
}

0 commit comments

Comments
 (0)