Files
vkd3d/tests/hlsl/distance.shader_test
Giovanni Mascellani 3186d66596 tests/hlsl: Do not test dst() on integer arguments with SM6.
That seems to hit a DXC bug we're not interested into.
2025-04-16 16:36:58 +02:00

113 lines
2.1 KiB
Plaintext

[pixel shader]
uniform float4 x;
uniform float4 y;
float4 main() : sv_target
{
return distance(x, y);
}
[test]
uniform 0 float4 -2.0 3.0 4.0 0.1
uniform 4 float4 2.0 -1.0 4.0 5.0
draw quad
probe (0, 0) rgba (7.483983, 7.483983, 7.483983, 7.483983) 1
[pixel shader]
uniform int4 x;
uniform int4 y;
float4 main() : sv_target
{
return distance(x, y);
}
[pixel shader]
uniform float4 src0;
uniform float4 src1;
float4 main() : SV_TARGET
{
return dst(src0, src1);
}
[test]
uniform 0 float4 16 32 48 64
uniform 4 float4 1.0 0.5 0.25 0.125
draw quad
probe (0, 0) rgba (1.0, 16.0, 48.0, 0.125)
[pixel shader]
float4 main() : SV_TARGET
{
return dst(int4(1, 2, 3, 4), int4(20, 40, 60, 80));
}
[test]
% DXC generates very strange code here, the first component is emitted with:
% call void @dx.op.storeOutput.f32(i32 5, i32 0, i32 0, i8 0,
% float sitofp (ppc_fp128 0xM3FF00000000000000000000000000000 to float))
% I don't know what's going on here, but the downstream compilers clearly don't
% like it: NVIDIA fails to create the PSO, AMD returns zero (instead of expected
% one) and WARP loses the device; it's not our bug, we can ignore it.
if(sm<6) draw quad
if(sm<6) probe (0, 0) rgba(1.0, 80.0, 3.0, 80.0)
[pixel shader]
float4 main() : SV_TARGET
{
return dst(76.0, 4.0);
}
[test]
draw quad
probe (0, 0) rgba (1.0, 304.0, 76.0, 4.0)
[pixel shader fail]
float4 main() : SV_TARGET
{
float2 bad_size = 0;
dst(bad_size, bad_size);
return float4(1, 2, 3, 4);
}
[pixel shader fail]
float4 main() : SV_TARGET
{
float4x4 bad_size = 0;
dst(bad_size, bad_size);
return float4(1, 2, 3, 4);
}
[pixel shader fail]
float4 main() : SV_TARGET
{
float4x1 bad_size = 0;
dst(bad_size, bad_size);
return float4(1, 2, 3, 4);
}
[pixel shader fail]
float4 main() : SV_TARGET
{
float1x4 bad_size = 0;
dst(bad_size, bad_size);
return float4(1, 2, 3, 4);
}
[pixel shader fail]
float4 main() : SV_TARGET
{
float1x1 bad_size = 0;
dst(bad_size, bad_size);
return float4(1, 2, 3, 4);
}
[pixel shader fail]
float4 main() : SV_TARGET
{
float1 bad_size = 0;
dst(bad_size, bad_size);
return float4(1, 2, 3, 4);
}