Skip to content

Commit

Permalink
Only report on first texture builtin error (#3919)
Browse files Browse the repository at this point in the history
Each texture test tests 50 calls to `textureXXX`. It then
checks they all match as expected. For each one that does NOT match
expected a slow binary search happens to find the samples that
influenced the results.

This change makes it so only the first failure does this slow
check. Ideally no tests would fail but when they do, checking all
50 sample points can cause test bots to timeout.
  • Loading branch information
greggman authored Aug 26, 2024
1 parent 08ed9c3 commit c23a47b
Showing 1 changed file with 10 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1308,7 +1308,7 @@ export async function checkCallResults<T extends Dimensionality>(
? getMaxFractionalDiffForTextureFormat(texture.descriptor.format)
: 0;

for (let callIdx = 0; callIdx < calls.length /*&& errs.length === 0*/; callIdx++) {
for (let callIdx = 0; callIdx < calls.length; callIdx++) {
const call = calls[callIdx];
const gotRGBA = results[callIdx];
const expectRGBA = softwareTextureReadLevel(t, call, texture, sampler, call.mipLevel ?? 0);
Expand Down Expand Up @@ -1356,7 +1356,11 @@ export async function checkCallResults<T extends Dimensionality>(
return { absDiff, relDiff, ulpDiff };
});

const fix5 = (n: number) => n.toFixed(5);
const isFloatType = (format: GPUTextureFormat) => {
const info = kTextureFormatInfo[format];
return info.color?.type === 'float' || info.depth?.type === 'depth';
};
const fix5 = (n: number) => (isFloatType(format) ? n.toFixed(5) : n.toString());
const fix5v = (arr: number[]) => arr.map(v => fix5(v)).join(', ');
const rgbaToArray = (p: PerTexelComponent<number>): number[] =>
rgbaComponentsToCheck.map(component => p[component]!);
Expand Down Expand Up @@ -1410,6 +1414,10 @@ export async function checkCallResults<T extends Dimensionality>(
errs.push(' sample points:');
errs.push(layoutTwoColumns(expectedSamplePoints, gotSamplePoints).join('\n'));
errs.push('', '');

// This path is slow so if we took it, don't report the other errors. One is enough
// to fail the test.
break;
}
}
}
Expand Down

0 comments on commit c23a47b

Please sign in to comment.