2023-06-19 07:40:57 -07:00
|
|
|
[require]
|
|
|
|
shader model >= 3.0
|
|
|
|
|
2023-04-26 07:29:14 -07:00
|
|
|
[pixel shader]
|
|
|
|
float4 main(float4 pos : sv_position) : sv_target
|
|
|
|
{
|
|
|
|
return float4(ddx(pos.x), ddy(pos.y), 0, 0);
|
|
|
|
}
|
|
|
|
|
|
|
|
[test]
|
2024-03-19 04:36:23 -07:00
|
|
|
todo(glsl) draw quad
|
2023-11-15 12:41:33 -08:00
|
|
|
todo(sm<4) probe all rgba (1.0, 1.0, 0.0, 0.0)
|
2023-04-26 07:29:14 -07:00
|
|
|
|
2023-06-19 07:40:57 -07:00
|
|
|
|
2023-04-26 07:29:14 -07:00
|
|
|
[pixel shader]
|
|
|
|
float4 main(float4 pos : sv_position) : sv_target
|
|
|
|
{
|
2023-06-19 07:40:57 -07:00
|
|
|
// Shader models < 4 don't add 0.5 to sv_position, so this adjustment is required to get the
|
|
|
|
// same outputs.
|
|
|
|
pos.x = floor(pos.x) + 0.5;
|
|
|
|
pos.y = floor(pos.y) + 0.5;
|
|
|
|
|
2023-04-26 07:29:14 -07:00
|
|
|
pos /= 10.0;
|
|
|
|
float nonlinear = pos.x * pos.y - pos.x * (pos.x + 0.5);
|
2023-06-05 13:51:52 -07:00
|
|
|
float4 res = float4(nonlinear, ddx(nonlinear), ddy(nonlinear), 0.0);
|
|
|
|
|
|
|
|
// Each device may use either the coarse or the fine derivate, so use quantization.
|
|
|
|
return round(30 * res);
|
2023-04-26 07:29:14 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
[test]
|
2024-03-19 04:36:23 -07:00
|
|
|
todo(glsl) draw quad
|
2023-11-15 12:41:33 -08:00
|
|
|
todo(sm<4) probe (10, 10) rgba (-16.0, -5.0, 3.0, 0.0)
|
|
|
|
todo(sm<4) probe (11, 10) rgba (-21.0, -5.0, 3.0, 0.0)
|
|
|
|
todo(sm<4) probe (10, 11) rgba (-13.0, -5.0, 3.0, 0.0)
|
|
|
|
todo(sm<4) probe (11, 11) rgba (-17.0, -5.0, 3.0, 0.0)
|
|
|
|
todo(sm<4) probe (12, 10) rgba (-26.0, -6.0, 4.0, 0.0)
|
|
|
|
todo(sm<4) probe (16, 16) rgba (-25.0, -7.0, 5.0, 0.0)
|
|
|
|
todo(sm<4) probe (150, 150) rgba (-226.0, -47.0, 45.0, 0.0)
|
2023-06-05 12:44:45 -07:00
|
|
|
|
|
|
|
|
|
|
|
[require]
|
|
|
|
shader model >= 5.0
|
|
|
|
|
|
|
|
|
2023-06-19 12:29:58 -07:00
|
|
|
[pixel shader]
|
2023-06-05 12:44:45 -07:00
|
|
|
float4 main(float4 pos : sv_position) : sv_target
|
|
|
|
{
|
|
|
|
pos /= 10.0;
|
|
|
|
float nonlinear = pos.x * pos.y - pos.x * (pos.x + 0.5);
|
2023-06-05 13:51:52 -07:00
|
|
|
float4 res = float4(nonlinear, ddx_coarse(nonlinear), ddy_coarse(nonlinear), 0.0);
|
|
|
|
|
|
|
|
// Each device may use either the coarse or the fine derivate, so use quantization.
|
|
|
|
return round(30 * res);
|
2023-06-05 12:44:45 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
[test]
|
2024-03-19 04:36:23 -07:00
|
|
|
todo(glsl) draw quad
|
2023-06-05 13:51:52 -07:00
|
|
|
probe (10, 10) rgba (-16.0, -5.0, 3.0, 0.0)
|
|
|
|
probe (11, 10) rgba (-21.0, -5.0, 3.0, 0.0)
|
|
|
|
probe (10, 11) rgba (-13.0, -5.0, 3.0, 0.0)
|
|
|
|
probe (11, 11) rgba (-17.0, -5.0, 3.0, 0.0)
|
|
|
|
probe (12, 10) rgba (-26.0, -6.0, 4.0, 0.0)
|
|
|
|
probe (16, 16) rgba (-25.0, -7.0, 5.0, 0.0)
|
|
|
|
probe (150, 150) rgba (-226.0, -47.0, 45.0, 0.0)
|
2023-06-05 12:44:45 -07:00
|
|
|
|
|
|
|
|
2023-06-19 13:05:36 -07:00
|
|
|
[pixel shader]
|
2023-06-05 12:44:45 -07:00
|
|
|
float4 main(float4 pos : sv_position) : sv_target
|
|
|
|
{
|
|
|
|
pos /= 10.0;
|
|
|
|
float nonlinear = pos.x * pos.y - pos.x * (pos.x + 0.5);
|
|
|
|
return float4(nonlinear, ddx_fine(nonlinear), ddy_fine(nonlinear), 0.0);
|
|
|
|
}
|
|
|
|
|
|
|
|
[test]
|
2024-03-19 04:36:23 -07:00
|
|
|
todo(glsl) draw quad
|
2023-06-05 12:44:45 -07:00
|
|
|
probe (10, 10) rgba (-0.524999976, -0.164999843, 0.104999900, 0.0) 16
|
|
|
|
probe (11, 10) rgba (-0.689999819, -0.164999843, 0.114999890, 0.0) 32
|
|
|
|
probe (10, 11) rgba (-0.420000076, -0.154999852, 0.104999900, 0.0) 32
|
|
|
|
probe (11, 11) rgba (-0.574999928, -0.154999852, 0.114999890, 0.0) 32
|
|
|
|
probe (12, 10) rgba (-0.874999881, -0.205000162, 0.124999881, 0.0) 24
|
|
|
|
probe (150, 150) rgba (-7.52500916, -1.56500244, 1.50500488, 0.0) 128
|