Skip to content

Commit 79e72c0

Browse files
authored
Texture Utils, log bad weights only if debugging (#4073)
1 parent 096f9fd commit 79e72c0

1 file changed

Lines changed: 7 additions & 5 deletions

File tree

src/webgpu/shader/execution/expression/call/builtin/texture_utils.ts

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -263,14 +263,16 @@ export function graphWeights(height: number, weights: number[]) {
263263
/**
264264
* Validates the weights go from 0 to 1 in increasing order.
265265
*/
266-
function validateWeights(stage: string, weights: number[]) {
267-
const showWeights = () => `
266+
function validateWeights(t: GPUTest, stage: string, weights: number[]) {
267+
const showWeights = t.rec.debugging
268+
? () => `
268269
${weights.map((v, i) => `${i.toString().padStart(2)}: ${v}`).join('\n')}
269270
270271
e = expected
271272
A = actual
272273
${graphWeights(32, weights)}
273-
`;
274+
`
275+
: () => ``;
274276

275277
// Validate the weights
276278
assert(
@@ -586,8 +588,8 @@ export async function queryMipLevelMixWeightsForDevice(t: GPUTest, stage: Shader
586588

587589
const [sampleLevelWeights, gradWeights] = unzip(result, kNumWeightTypes, 4);
588590

589-
validateWeights(stage, sampleLevelWeights);
590-
validateWeights(stage, gradWeights);
591+
validateWeights(t, stage, sampleLevelWeights);
592+
validateWeights(t, stage, gradWeights);
591593

592594
texture.destroy();
593595
storageBuffer.destroy();

0 commit comments

Comments
 (0)