2023-04-30 23:31:33 -05:00
|
|
|
[sampler 0]
|
|
|
|
filter linear linear linear
|
|
|
|
address clamp clamp clamp
|
|
|
|
|
2024-01-24 16:11:17 -03:00
|
|
|
[srv 0]
|
|
|
|
size (2d, 2, 2)
|
2023-04-30 23:31:33 -05:00
|
|
|
levels 2
|
|
|
|
|
|
|
|
1.0 0.0 1.0 0.0 1.0 0.0 1.0 0.0
|
|
|
|
1.0 0.0 1.0 0.0 1.0 0.0 1.0 0.0
|
|
|
|
|
|
|
|
0.0 0.0 1.0 0.0
|
|
|
|
|
|
|
|
[vertex shader]
|
2022-08-15 19:53:55 -05:00
|
|
|
void main(float4 pos : position, out float2 tex : texcoord, out float4 out_pos : sv_position)
|
2023-04-30 23:31:33 -05:00
|
|
|
{
|
|
|
|
tex = pos.xy;
|
2022-08-15 19:53:55 -05:00
|
|
|
out_pos = pos;
|
2023-04-30 23:31:33 -05:00
|
|
|
}
|
|
|
|
|
2024-12-03 17:05:48 -03:00
|
|
|
[pixel shader]
|
2023-04-30 23:31:33 -05:00
|
|
|
sampler s;
|
|
|
|
Texture2D t;
|
|
|
|
uniform float bias;
|
|
|
|
|
|
|
|
float4 main(float2 coord : texcoord) : sv_target
|
|
|
|
{
|
|
|
|
/* Choice of initial mipmap level is hardware-dependent, and in practice
|
|
|
|
* varies too much to be reasonably covered by ULPS. Quantize instead. */
|
|
|
|
return floor(t.SampleBias(s, coord, bias) * 10);
|
|
|
|
}
|
|
|
|
|
|
|
|
[test]
|
|
|
|
uniform 0 float4 6.5 0.0 0.0 0.0
|
2025-05-25 23:10:03 +02:00
|
|
|
draw quad
|
2024-02-10 13:16:22 -06:00
|
|
|
probe (0, 0) rgba (10.0, 0.0, 10.0, 0.0)
|
2023-04-30 23:31:33 -05:00
|
|
|
|
tests/hlsl: Slightly adjust the bias values in the sample-bias tests.
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.
2025-05-25 22:22:59 +02:00
|
|
|
uniform 0 float4 7.46 0.0 0.0 0.0
|
2025-05-25 23:10:03 +02:00
|
|
|
draw quad
|
2024-12-04 15:16:45 -03:00
|
|
|
probe (0, 0) rgba(4.0, 0.0, 10.0, 0.0)
|
2023-04-30 23:31:33 -05:00
|
|
|
|
|
|
|
uniform 0 float4 8.5 0.0 0.0 0.0
|
2025-05-25 23:10:03 +02:00
|
|
|
draw quad
|
2024-12-04 15:16:45 -03:00
|
|
|
probe (0, 0) rgba(0.0, 0.0, 10.0, 0.0)
|
2024-05-21 18:18:11 +02:00
|
|
|
|
|
|
|
[require]
|
|
|
|
shader model >= 3.0
|
|
|
|
options: backcompat
|
|
|
|
|
2024-12-11 23:15:59 -06:00
|
|
|
[pixel shader fail(sm>=5.1) todo(sm>=5.1)]
|
2024-05-21 18:18:11 +02:00
|
|
|
sampler s;
|
|
|
|
float bias;
|
|
|
|
|
|
|
|
float4 main(float2 coord : texcoord) : sv_target
|
|
|
|
{
|
|
|
|
/* Choice of initial mipmap level is hardware-dependent, and in practice
|
|
|
|
* varies too much to be reasonably covered by ULPS. Quantize instead. */
|
|
|
|
return floor(tex2Dbias(s, float4(coord, 0, bias)) * 10);
|
|
|
|
}
|
|
|
|
|
|
|
|
[test]
|
|
|
|
uniform 0 float4 6.5 0.0 0.0 0.0
|
2025-05-25 23:10:03 +02:00
|
|
|
draw quad
|
2024-02-10 13:16:22 -06:00
|
|
|
probe (0, 0) rgba (10.0, 0.0, 10.0, 0.0)
|
2024-05-21 18:18:11 +02:00
|
|
|
|
tests/hlsl: Slightly adjust the bias values in the sample-bias tests.
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.
2025-05-25 22:22:59 +02:00
|
|
|
uniform 0 float4 7.46 0.0 0.0 0.0
|
2025-05-25 23:10:03 +02:00
|
|
|
draw quad
|
2024-12-04 15:16:45 -03:00
|
|
|
probe (0,0) rgba(4.0, 0.0, 10.0, 0.0)
|
2024-05-21 18:18:11 +02:00
|
|
|
|
|
|
|
uniform 0 float4 8.5 0.0 0.0 0.0
|
2025-05-25 23:10:03 +02:00
|
|
|
draw quad
|
2024-12-04 15:16:45 -03:00
|
|
|
probe (0,0) rgba(0.0, 0.0, 10.0, 0.0)
|
2025-08-14 19:29:46 -04:00
|
|
|
|
|
|
|
[require]
|
|
|
|
% Reset requirements
|
|
|
|
|
|
|
|
[srv 0]
|
|
|
|
size (cube, 2)
|
|
|
|
levels 2
|
|
|
|
|
|
|
|
1.0 0.0 1.0 0.0 1.0 0.0 1.0 0.0 1.0 0.0 1.0 0.0 1.0 0.0 1.0 0.0
|
|
|
|
1.0 0.0 1.0 0.0 1.0 0.0 1.0 0.0 1.0 0.0 1.0 0.0 1.0 0.0 1.0 0.0
|
|
|
|
1.0 0.0 1.0 0.0 1.0 0.0 1.0 0.0 1.0 0.0 1.0 0.0 1.0 0.0 1.0 0.0
|
|
|
|
1.0 0.0 1.0 0.0 1.0 0.0 1.0 0.0 1.0 0.0 1.0 0.0 1.0 0.0 1.0 0.0
|
|
|
|
1.0 0.0 1.0 0.0 1.0 0.0 1.0 0.0 1.0 0.0 1.0 0.0 1.0 0.0 1.0 0.0
|
|
|
|
1.0 0.0 1.0 0.0 1.0 0.0 1.0 0.0 1.0 0.0 1.0 0.0 1.0 0.0 1.0 0.0
|
|
|
|
|
|
|
|
0.0 0.0 1.0 0.0
|
|
|
|
0.0 0.0 1.0 0.0
|
|
|
|
0.0 0.0 1.0 0.0
|
|
|
|
0.0 0.0 1.0 0.0
|
|
|
|
0.0 0.0 1.0 0.0
|
|
|
|
0.0 0.0 1.0 0.0
|
|
|
|
|
|
|
|
[pixel shader]
|
|
|
|
sampler s;
|
|
|
|
TextureCube t;
|
|
|
|
uniform float bias;
|
|
|
|
|
|
|
|
float4 main(float2 coord : texcoord) : sv_target
|
|
|
|
{
|
|
|
|
/* Choice of initial mipmap level is hardware-dependent, and in practice
|
|
|
|
* varies too much to be reasonably covered by ULPS. Quantize instead. */
|
|
|
|
return floor(t.SampleBias(s, float3(coord, 1), bias) * 5) * 2;
|
|
|
|
}
|
|
|
|
|
|
|
|
[test]
|
|
|
|
uniform 0 float 7.9
|
|
|
|
draw quad
|
|
|
|
probe (0, 0) f32(10.0, 0.0, 10.0, 0.0)
|
|
|
|
|
|
|
|
uniform 0 float 8.4
|
|
|
|
draw quad
|
|
|
|
probe (0, 0) f32(4.0, 0.0, 10.0, 0.0)
|
|
|
|
|
|
|
|
uniform 0 float 8.9
|
|
|
|
draw quad
|
|
|
|
probe (0, 0) f32(0.0, 0.0, 10.0, 0.0)
|
|
|
|
|
|
|
|
[require]
|
|
|
|
shader model >= 3.0
|
|
|
|
options: backcompat
|
|
|
|
|
2025-08-24 19:02:25 -04:00
|
|
|
[pixel shader fail(sm>=5.1) todo(sm>=5.1)]
|
2025-08-14 19:29:46 -04:00
|
|
|
sampler s;
|
|
|
|
float bias;
|
|
|
|
|
|
|
|
float4 main(float2 coord : texcoord) : sv_target
|
|
|
|
{
|
|
|
|
/* Choice of initial mipmap level is hardware-dependent, and in practice
|
|
|
|
* varies too much to be reasonably covered by ULPS. Quantize instead. */
|
|
|
|
return floor(texCUBEbias(s, float4(coord, 1, bias)) * 5) * 2;
|
|
|
|
}
|
|
|
|
|
|
|
|
[test]
|
|
|
|
uniform 0 float 7.9
|
2025-08-24 19:02:25 -04:00
|
|
|
draw quad
|
2025-08-14 19:29:46 -04:00
|
|
|
probe (0, 0) f32(10.0, 0.0, 10.0, 0.0)
|
|
|
|
|
|
|
|
uniform 0 float 8.4
|
2025-08-24 19:02:25 -04:00
|
|
|
draw quad
|
2025-08-14 19:29:46 -04:00
|
|
|
probe (0, 0) f32(4.0, 0.0, 10.0, 0.0)
|
|
|
|
|
|
|
|
uniform 0 float 8.9
|
2025-08-24 19:02:25 -04:00
|
|
|
draw quad
|
2025-08-14 19:29:46 -04:00
|
|
|
probe (0, 0) f32(0.0, 0.0, 10.0, 0.0)
|