From 9983d9c4de5de6c9258503b2514956a51bb00840 Mon Sep 17 00:00:00 2001 From: Henri Verbeet Date: Sun, 25 May 2025 22:22:59 +0200 Subject: [PATCH] tests/hlsl: Slightly adjust the bias values in the sample-bias tests. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The expected λ value for the tests in question is about 0.59, which after linear mipmap interpolation should result in a sampled value of about 0.41. The quantisation step was added to allow results as high as 0.43, as seen on some implementations. AMD Radeon Pro Vega 20 on macOS 15.5 returns a sampled value of about 0.39, with both Vulkan/MoltenVK and MSL/Metal. This is not an issue with the bias calculation; the same behaviour could be reproduced with SampleLevel(), as used in the sample-level tests, if those tests used more exciting values for the "level" parameter. It also doesn't appear to be a general Metal issue; Intel UHD Graphics 630 does return the expected values on the same setup. Instead, this appears to be a mipmap interpolation issue on this particular GPU/driver. Mapping the sampled values for "level" from 0.0 to 1.0, it seems the interpolation factor used is "saturate(frac(λ) * 1.25 - 0.125)", instead of the normal "frac(λ)". Fascinating as that may be, the test here mainly cares about whether the bias value was applied correctly, and in that regard a sampled value of 0.39 isn't any worse than the 0.43 we already accept. This commit adjusts the bias value so that the expected sampled value is 0.45, which makes the accepted error the same on both the positive and negative side. --- tests/hlsl/sample-bias.shader_test | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/hlsl/sample-bias.shader_test b/tests/hlsl/sample-bias.shader_test index d3843134d..cec516f6c 100644 --- a/tests/hlsl/sample-bias.shader_test +++ b/tests/hlsl/sample-bias.shader_test @@ -35,7 +35,7 @@ uniform 0 float4 6.5 0.0 0.0 0.0 todo(msl) draw quad probe (0, 0) rgba (10.0, 0.0, 10.0, 0.0) -uniform 0 float4 7.5 0.0 0.0 0.0 +uniform 0 float4 7.46 0.0 0.0 0.0 todo(msl) draw quad probe (0, 0) rgba(4.0, 0.0, 10.0, 0.0) @@ -63,7 +63,7 @@ uniform 0 float4 6.5 0.0 0.0 0.0 todo(msl) draw quad probe (0, 0) rgba (10.0, 0.0, 10.0, 0.0) -uniform 0 float4 7.5 0.0 0.0 0.0 +uniform 0 float4 7.46 0.0 0.0 0.0 todo(msl) draw quad probe (0,0) rgba(4.0, 0.0, 10.0, 0.0)