Files
vkd3d/tests/hlsl/ps1-projection.shader_test
Henri Verbeet 3431c006ae tests/hlsl: Avoid sampling on texel edges in ps1-projection.shader_test.
In the projected case, (1.2, 0.5) divided by 2.0 results in (0.6, 0.25) as
effective coordinates. The 0.25 y-coordinate is well within the second row of
texels; that's fine. On the other hand, the 0.6 x-coordinate falls right
between the third and fourth column of texels. The test expects the fourth
column to be selected, but that's very fragile: neither 1.2 nor 0.6 can be
exactly represented as a 32-bit floating-point value, and it only takes a
single ulp to push things to the other side of the edge.
2025-11-24 18:54:54 +01:00

63 lines
1.6 KiB
Plaintext

% Test for the D3DTTFF_* projected texture flags.
[require]
shader model < 3.0
[sampler 0]
filter point point point
address clamp clamp clamp
[srv 0]
size (2d, 5, 5)
.0 .0 .0 .1 .1 .0 .0 .1 .2 .0 .0 .1 .3 .0 .0 .1 .4 .0 .0 .1
.0 .1 .0 .1 .1 .1 .0 .1 .2 .1 .0 .1 .3 .1 .0 .1 .4 .1 .0 .1
.0 .2 .0 .1 .1 .2 .0 .1 .2 .2 .0 .1 .3 .2 .0 .1 .4 .2 .0 .1
.0 .3 .0 .1 .1 .3 .0 .1 .2 .3 .0 .1 .3 .3 .0 .1 .4 .3 .0 .1
.0 .4 .0 .1 .1 .4 .0 .1 .2 .4 .0 .1 .3 .4 .0 .1 .4 .4 .0 .1
[vertex shader]
void main(inout float4 pos : position, out float4 tex : texcoord)
{
tex = float4(1.4, 0.5, 4.0, 2.0);
}
[pixel shader d3dbc-hex]
% TODO: Convert to assembly or HLSL.
ffff0101 % ps_1_1
00000042 b00f0000 % tex t0
00000001 800f0000 b0e40000 % mov r0, t0
0000ffff % end
[test]
projected 0 disable
draw quad
probe (0, 0) f32(0.4, 0.2, 0.0, 0.1)
projected 0 enable
draw quad
probe (0, 0) f32(0.3, 0.1, 0.0, 0.1)
% Doesn't affect 1.4 or 2.0.
[pixel shader d3dbc-hex]
% TODO: Convert to assembly or HLSL.
ffff0104 % ps_1_4
00000042 800f0000 b0e40000 % texld r0, t0
0000ffff % end
[test]
projected 0 enable
draw quad
probe (0, 0) f32(0.4, 0.2, 0.0, 0.1)
[pixel shader]
sampler sam;
float4 main(float2 tex : texcoord) : sv_target
{
return tex2D(sam, tex);
}
[test]
projected 0 enable
draw quad
probe (0, 0) f32(0.4, 0.2, 0.0, 0.1)