2023-09-06 13:14:12 -07:00
|
|
|
% TPF does not define instructions for inverse trig; these intrinsics are
|
|
|
|
% decomposed into other instructions. FXC emits code which may vary wrt other
|
|
|
|
% implementations. DXIL defines intrinsics for inverse trig, to be implemented
|
|
|
|
% by the backend.
|
|
|
|
|
2023-11-01 13:07:46 -07:00
|
|
|
[pixel shader]
|
2023-09-06 13:14:12 -07:00
|
|
|
uniform float4 a;
|
|
|
|
|
|
|
|
float4 main() : sv_target
|
|
|
|
{
|
|
|
|
return float4(acos(a.x), 0.0, 0.0, 0.0);
|
|
|
|
}
|
|
|
|
|
|
|
|
[test]
|
|
|
|
uniform 0 float4 -1.0 0.0 0.0 0.0
|
2024-05-02 16:29:23 -07:00
|
|
|
draw quad
|
2024-02-10 11:16:22 -08:00
|
|
|
probe (0, 0) rgba (3.14159274, 0.0, 0.0, 0.0) 128
|
2023-09-06 13:14:12 -07:00
|
|
|
|
|
|
|
uniform 0 float4 -0.5 0.0 0.0 0.0
|
2024-05-02 16:29:23 -07:00
|
|
|
draw quad
|
2024-02-10 11:16:22 -08:00
|
|
|
probe (0, 0) rgba (2.094441441, 0.0, 0.0, 0.0) 256
|
2023-09-06 13:14:12 -07:00
|
|
|
|
|
|
|
uniform 0 float4 0.0 0.0 0.0 0.0
|
2024-05-02 16:29:23 -07:00
|
|
|
draw quad
|
2024-02-10 11:16:22 -08:00
|
|
|
probe (0, 0) rgba (1.57072878, 0.0, 0.0, 0.0) 1024
|
2023-09-06 13:14:12 -07:00
|
|
|
|
|
|
|
uniform 0 float4 0.5 0.0 0.0 0.0
|
2024-05-02 16:29:23 -07:00
|
|
|
draw quad
|
2024-02-10 11:16:22 -08:00
|
|
|
probe (0, 0) rgba (1.04715133, 0.0, 0.0, 0.0) 512
|
2023-09-06 13:14:12 -07:00
|
|
|
|
|
|
|
uniform 0 float4 1.0 0.0 0.0 0.0
|
2024-05-02 16:29:23 -07:00
|
|
|
draw quad
|
2024-02-10 11:16:22 -08:00
|
|
|
probe (0, 0) rgba (0.0, 0.0, 0.0, 0.0) 128
|
2023-09-06 13:14:12 -07:00
|
|
|
|
2023-11-01 13:07:46 -07:00
|
|
|
[pixel shader]
|
2023-09-06 13:14:12 -07:00
|
|
|
uniform float4 a;
|
|
|
|
|
|
|
|
float4 main() : sv_target
|
|
|
|
{
|
|
|
|
float4 result = float4(asin(a.x), 0.0, 0.0, 0.0);
|
|
|
|
// Quantize to cover implementation variations, which are quite large for asin().
|
|
|
|
return round(result * 20000.0);
|
|
|
|
}
|
|
|
|
|
|
|
|
[test]
|
|
|
|
uniform 0 float4 -1.0 0.0 0.0 0.0
|
2022-12-05 18:46:22 -08:00
|
|
|
todo(glsl) draw quad
|
2024-02-10 11:16:22 -08:00
|
|
|
probe (0, 0) rgba (-31416.0, 0.0, 0.0, 0.0)
|
2023-09-06 13:14:12 -07:00
|
|
|
|
|
|
|
[require]
|
|
|
|
shader model < 6.0
|
|
|
|
|
|
|
|
[test]
|
|
|
|
uniform 0 float4 -0.5 0.0 0.0 0.0
|
2022-12-05 18:46:22 -08:00
|
|
|
todo(glsl) draw quad
|
2024-02-10 11:16:22 -08:00
|
|
|
probe (0, 0) rgba (-10473.0, 0.0, 0.0, 0.0)
|
2023-09-06 13:14:12 -07:00
|
|
|
|
|
|
|
uniform 0 float4 0.0 0.0 0.0 0.0
|
2022-12-05 18:46:22 -08:00
|
|
|
todo(glsl) draw quad
|
2024-02-10 11:16:22 -08:00
|
|
|
probe (0, 0) rgba (1.0, 0.0, 0.0, 0.0)
|
2023-09-06 13:14:12 -07:00
|
|
|
|
|
|
|
uniform 0 float4 0.5 0.0 0.0 0.0
|
2022-12-05 18:46:22 -08:00
|
|
|
todo(glsl) draw quad
|
2024-02-10 11:16:22 -08:00
|
|
|
probe (0, 0) rgba (10473.0, 0.0, 0.0, 0.0)
|
2023-09-06 13:14:12 -07:00
|
|
|
|
|
|
|
[require]
|
|
|
|
shader model >= 6.0
|
|
|
|
|
|
|
|
% We implement SM 6.0 inverse trig instructions using the native equivalents
|
|
|
|
% available in the backend. The values below are from the AMD Windows drivers,
|
|
|
|
% which are very close to those from Ubuntu's calculator app. Results from
|
|
|
|
% RADV are a bit lower than these, hence the large max ulp difference.
|
|
|
|
[test]
|
|
|
|
uniform 0 float4 -0.5 0.0 0.0 0.0
|
2024-01-21 22:00:47 -08:00
|
|
|
draw quad
|
2024-02-10 11:16:22 -08:00
|
|
|
probe (0, 0) rgba (-10472.0, 0.0, 0.0, 0.0) 4096
|
2023-09-06 13:14:12 -07:00
|
|
|
|
|
|
|
uniform 0 float4 0.0 0.0 0.0 0.0
|
2024-01-21 22:00:47 -08:00
|
|
|
draw quad
|
2024-02-10 11:16:22 -08:00
|
|
|
probe (0, 0) rgba (0.0, 0.0, 0.0, 0.0)
|
2023-09-06 13:14:12 -07:00
|
|
|
|
|
|
|
uniform 0 float4 0.5 0.0 0.0 0.0
|
2024-01-21 22:00:47 -08:00
|
|
|
draw quad
|
2024-02-10 11:16:22 -08:00
|
|
|
probe (0, 0) rgba (10472.0, 0.0, 0.0, 0.0) 4096
|
2023-09-06 13:14:12 -07:00
|
|
|
|
|
|
|
[require]
|
|
|
|
% reset requirements
|
|
|
|
|
|
|
|
[test]
|
|
|
|
uniform 0 float4 1.0 0.0 0.0 0.0
|
2022-12-05 18:46:22 -08:00
|
|
|
todo(glsl) draw quad
|
2024-02-10 11:16:22 -08:00
|
|
|
probe (0, 0) rgba (31416.0, 0.0, 0.0, 0.0)
|
2023-12-07 09:07:42 -08:00
|
|
|
|
|
|
|
|
2024-03-01 11:01:03 -08:00
|
|
|
[pixel shader]
|
2023-12-07 09:07:42 -08:00
|
|
|
uniform float4 a;
|
|
|
|
|
|
|
|
float4 main() : sv_target
|
|
|
|
{
|
|
|
|
return float4(atan(a.x), 0.0, 0.0, 0.0);
|
|
|
|
}
|
|
|
|
|
|
|
|
[test]
|
|
|
|
uniform 0 float4 -1.0 0.0 0.0 0.0
|
2024-03-01 11:01:03 -08:00
|
|
|
todo(glsl) draw quad
|
2024-02-10 11:16:22 -08:00
|
|
|
probe (0, 0) rgba (-0.785409629, 0.0, 0.0, 0.0) 512
|
2023-12-07 09:07:42 -08:00
|
|
|
|
|
|
|
uniform 0 float4 -0.5 0.0 0.0 0.0
|
2024-03-01 11:01:03 -08:00
|
|
|
todo(glsl) draw quad
|
2024-02-10 11:16:22 -08:00
|
|
|
probe (0, 0) rgba (-0.4636476, 0.0, 0.0, 0.0) 256
|
2023-12-07 09:07:42 -08:00
|
|
|
|
|
|
|
uniform 0 float4 0.0 0.0 0.0 0.0
|
2024-03-01 11:01:03 -08:00
|
|
|
todo(glsl) draw quad
|
2024-02-10 11:16:22 -08:00
|
|
|
probe (0, 0) rgba (0.0, 0.0, 0.0, 0.0) 256
|
2023-12-07 09:07:42 -08:00
|
|
|
|
|
|
|
uniform 0 float4 0.5 0.0 0.0 0.0
|
2024-03-01 11:01:03 -08:00
|
|
|
todo(glsl) draw quad
|
2024-02-10 11:16:22 -08:00
|
|
|
probe (0, 0) rgba (0.4636476, 0.0, 0.0, 0.0) 256
|
2023-12-07 09:07:42 -08:00
|
|
|
|
|
|
|
uniform 0 float4 1.0 0.0 0.0 0.0
|
2024-03-01 11:01:03 -08:00
|
|
|
todo(glsl) draw quad
|
2024-02-10 11:16:22 -08:00
|
|
|
probe (0, 0) rgba (0.785409629, 0.0, 0.0, 0.0) 512
|
2023-12-07 09:07:42 -08:00
|
|
|
|
2024-03-01 11:01:03 -08:00
|
|
|
[pixel shader]
|
2023-12-07 09:07:42 -08:00
|
|
|
uniform float4 a;
|
|
|
|
|
|
|
|
float4 main() : sv_target
|
|
|
|
{
|
|
|
|
// The argument order is (y,x), and test case inputs are (y,x) also.
|
|
|
|
return float4(atan2(a.x, a.y), 0.0, 0.0, 0.0);
|
|
|
|
}
|
|
|
|
|
|
|
|
[test]
|
|
|
|
% Non-degenerate cases
|
|
|
|
uniform 0 float4 1.0 1.0 0.0 0.0
|
2024-03-01 11:01:03 -08:00
|
|
|
todo(glsl) draw quad
|
2024-02-10 11:16:22 -08:00
|
|
|
probe (0, 0) rgba (0.785385, 0.0, 0.0, 0.0) 512
|
2023-12-07 09:07:42 -08:00
|
|
|
|
|
|
|
uniform 0 float4 5.0 -5.0 0.0 0.0
|
2024-03-01 11:01:03 -08:00
|
|
|
todo(glsl) draw quad
|
2024-02-10 11:16:22 -08:00
|
|
|
probe (0, 0) rgba (2.356194, 0.0, 0.0, 0.0) 256
|
2023-12-07 09:07:42 -08:00
|
|
|
|
|
|
|
uniform 0 float4 -3.0 -3.0 0.0 0.0
|
2024-03-01 11:01:03 -08:00
|
|
|
todo(glsl) draw quad
|
2024-02-10 11:16:22 -08:00
|
|
|
probe (0, 0) rgba (-2.356194, 0.0, 0.0, 0.0) 256
|
2023-12-07 09:07:42 -08:00
|
|
|
|
|
|
|
uniform 0 float4 1.0 0.0 0.0 0.0
|
2024-03-01 11:01:03 -08:00
|
|
|
todo(glsl) draw quad
|
2024-02-10 11:16:22 -08:00
|
|
|
probe (0, 0) rgba (1.570796, 0.0, 0.0, 0.0) 256
|
2023-12-07 09:07:42 -08:00
|
|
|
|
|
|
|
uniform 0 float4 -1.0 0.0 0.0 0.0
|
2024-03-01 11:01:03 -08:00
|
|
|
todo(glsl) draw quad
|
2024-02-10 11:16:22 -08:00
|
|
|
probe (0, 0) rgba (-1.570796, 0.0, 0.0, 0.0) 256
|
2023-12-07 09:07:42 -08:00
|
|
|
|
|
|
|
uniform 0 float4 0.0 1.0 0.0 0.0
|
2024-03-01 11:01:03 -08:00
|
|
|
todo(glsl) draw quad
|
2024-02-10 11:16:22 -08:00
|
|
|
probe (0, 0) rgba (0.0, 0.0, 0.0, 0.0) 256
|
2023-12-07 09:07:42 -08:00
|
|
|
|
|
|
|
uniform 0 float4 0.0 -1.0 0.0 0.0
|
2024-03-01 11:01:03 -08:00
|
|
|
todo(glsl) draw quad
|
2024-02-10 11:16:22 -08:00
|
|
|
probe (0, 0) rgba (3.1415927, 0.0, 0.0, 0.0) 256
|
2023-12-07 09:07:42 -08:00
|
|
|
|
|
|
|
% Degenerate cases
|
|
|
|
uniform 0 float4 0.00001 0.00002 0.0 0.0
|
2024-03-01 11:01:03 -08:00
|
|
|
todo(glsl) draw quad
|
2024-02-10 11:16:22 -08:00
|
|
|
probe (0, 0) rgba (0.463647, 0.0, 0.0, 0.0) 256
|
2023-12-07 09:07:42 -08:00
|
|
|
|
|
|
|
uniform 0 float4 0.00001 -0.00002 0.0 0.0
|
2024-03-01 11:01:03 -08:00
|
|
|
todo(glsl) draw quad
|
2024-02-10 11:16:22 -08:00
|
|
|
probe (0, 0) rgba (2.677945, 0.0, 0.0, 0.0) 256
|
2023-12-07 09:07:42 -08:00
|
|
|
|
|
|
|
uniform 0 float4 -0.00001 100000.0 0.0 0.0
|
2024-03-01 11:01:03 -08:00
|
|
|
todo(glsl) draw quad
|
2024-02-10 11:16:22 -08:00
|
|
|
probe (0, 0) rgba (-0.000000000099986595, 0.0, 0.0, 0.0) 2048
|
2023-12-07 09:07:42 -08:00
|
|
|
|
|
|
|
uniform 0 float4 10000000.0 0.00000001 0.0 0.0
|
2024-03-01 11:01:03 -08:00
|
|
|
todo(glsl) draw quad
|
2024-02-10 11:16:22 -08:00
|
|
|
probe (0, 0) rgba (1.570796, 0.0, 0.0, 0.0) 256
|
2023-12-07 09:07:42 -08:00
|
|
|
|
|
|
|
% Negative zero behavior should be to treat it the
|
|
|
|
% same as normal zero.
|
|
|
|
uniform 0 float4 1000000000.0 0.0 0.0 0.0
|
2024-03-01 11:01:03 -08:00
|
|
|
todo(glsl) draw quad
|
2024-02-10 11:16:22 -08:00
|
|
|
probe (0, 0) rgba (1.570796, 0.0, 0.0, 0.0) 256
|
2023-12-07 09:07:42 -08:00
|
|
|
|
|
|
|
uniform 0 float4 1000000000.0 -0.0 0.0 0.0
|
2024-03-01 11:01:03 -08:00
|
|
|
todo(glsl) draw quad
|
2024-02-10 11:16:22 -08:00
|
|
|
probe (0, 0) rgba (1.570796, 0.0, 0.0, 0.0) 256
|
2023-12-07 09:07:42 -08:00
|
|
|
|
|
|
|
uniform 0 float4 0.0 -1.0 0.0 0.0
|
2024-03-01 11:01:03 -08:00
|
|
|
todo(glsl) draw quad
|
2024-02-10 11:16:22 -08:00
|
|
|
probe (0, 0) rgba (3.1415927, 0.0, 0.0, 0.0) 256
|
2023-12-07 09:07:42 -08:00
|
|
|
|
|
|
|
uniform 0 float4 -0.0 -1.0 0.0 0.0
|
2024-03-01 11:01:03 -08:00
|
|
|
todo(glsl) draw quad
|
2024-02-10 11:16:22 -08:00
|
|
|
probe (0, 0) rgba (3.1415927, 0.0, 0.0, 0.0) 256
|