From 701e646366987461e8019725a26ee527f7f8c735 Mon Sep 17 00:00:00 2001 From: Greggman Date: Wed, 14 Aug 2024 08:46:44 -0700 Subject: [PATCH] Fix textureSampleLevel tests. (#3903) The tests query the GPUs mip to mip interpolation. The test that the query was successful was too strict so this PR relaxes that check. --- .../execution/expression/call/builtin/texture_utils.ts | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/webgpu/shader/execution/expression/call/builtin/texture_utils.ts b/src/webgpu/shader/execution/expression/call/builtin/texture_utils.ts index e997833a137f..38e94675f3e0 100644 --- a/src/webgpu/shader/execution/expression/call/builtin/texture_utils.ts +++ b/src/webgpu/shader/execution/expression/call/builtin/texture_utils.ts @@ -203,9 +203,12 @@ async function initMipGradientValuesForDevice(t: GPUTest) { resultBuffer.destroy(); // Validate the weights - assert(weights[0] === 0); - assert(weights[kMipGradientSteps] === 1); - assert(weights[kMipGradientSteps / 2] === 0.5); + assert(weights[0] === 0, 'weight 0 is 0'); + assert(weights[kMipGradientSteps] === 1, 'top weight is 1'); + assert( + Math.abs(weights[kMipGradientSteps / 2] - 0.5) < 0.0001, + 'middle weight is approximately 0.5' + ); // Note: for 16 steps, these are the AMD weights //