summaryrefslogtreecommitdiffstats
path: root/dom/webgpu/tests/cts/checkout/src/webgpu/util/texture/texture_ok.ts
diff options
context:
space:
mode:
Diffstat (limited to 'dom/webgpu/tests/cts/checkout/src/webgpu/util/texture/texture_ok.ts')
-rw-r--r--dom/webgpu/tests/cts/checkout/src/webgpu/util/texture/texture_ok.ts20
1 files changed, 11 insertions, 9 deletions
diff --git a/dom/webgpu/tests/cts/checkout/src/webgpu/util/texture/texture_ok.ts b/dom/webgpu/tests/cts/checkout/src/webgpu/util/texture/texture_ok.ts
index 7b85489246..d0267f0627 100644
--- a/dom/webgpu/tests/cts/checkout/src/webgpu/util/texture/texture_ok.ts
+++ b/dom/webgpu/tests/cts/checkout/src/webgpu/util/texture/texture_ok.ts
@@ -2,7 +2,7 @@ import { assert, ErrorWithExtra, unreachable } from '../../../common/util/util.j
import { kTextureFormatInfo, EncodableTextureFormat } from '../../format_info.js';
import { GPUTest } from '../../gpu_test.js';
import { numbersApproximatelyEqual } from '../conversion.js';
-import { generatePrettyTable } from '../pretty_diff_tables.js';
+import { generatePrettyTable, numericToStringBuilder } from '../pretty_diff_tables.js';
import { reifyExtent3D, reifyOrigin3D } from '../unions.js';
import { fullSubrectCoordinates } from './base.js';
@@ -223,11 +223,13 @@ export function findFailedPixels(
const info = kTextureFormatInfo[format];
const repr = kTexelRepresentationInfo[format];
-
- const integerSampleType = info.sampleType === 'uint' || info.sampleType === 'sint';
- const numberToString = integerSampleType
- ? (n: number) => n.toFixed()
- : (n: number) => n.toPrecision(6);
+ // MAINTENANCE_TODO: Print depth-stencil formats as float+int instead of float+float.
+ const printAsInteger = info.color
+ ? // For color, pick the type based on the format type
+ ['uint', 'sint'].includes(info.color.type)
+ : // Print depth as "float", depth-stencil as "float,float", stencil as "int".
+ !info.depth;
+ const numericToString = numericToStringBuilder(printAsInteger);
const componentOrderStr = repr.componentOrder.join(',') + ':';
@@ -245,14 +247,14 @@ export function findFailedPixels(
yield* [' act. colors', '==', componentOrderStr];
for (const coords of failedPixels) {
const pixel = actTexelView.color(coords);
- yield `${repr.componentOrder.map(ch => numberToString(pixel[ch]!)).join(',')}`;
+ yield `${repr.componentOrder.map(ch => numericToString(pixel[ch]!)).join(',')}`;
}
})();
const printExpectedColors = (function* () {
yield* [' exp. colors', '==', componentOrderStr];
for (const coords of failedPixels) {
const pixel = expTexelView.color(coords);
- yield `${repr.componentOrder.map(ch => numberToString(pixel[ch]!)).join(',')}`;
+ yield `${repr.componentOrder.map(ch => numericToString(pixel[ch]!)).join(',')}`;
}
})();
const printActualULPs = (function* () {
@@ -272,7 +274,7 @@ export function findFailedPixels(
const opts = {
fillToWidth: 120,
- numberToString,
+ numericToString,
};
return `\
between ${lowerCorner} and ${upperCorner} inclusive: