2024-02-23 01:53:49 -08:00
|
|
|
% Test the interaction between integer constant folding and the fact
|
|
|
|
% that integers are secretly considered floats in SM1-3
|
|
|
|
|
|
|
|
[pixel shader]
|
|
|
|
float4 main() : SV_TARGET
|
|
|
|
{
|
|
|
|
uint x = 3000000000u;
|
|
|
|
return float4(x, 0.0, 0.0, 0.0);
|
|
|
|
}
|
|
|
|
|
|
|
|
[test]
|
2021-08-19 13:00:58 -07:00
|
|
|
draw quad
|
2024-02-10 11:16:22 -08:00
|
|
|
probe (0, 0) rgba (3.0e+009, 0.0, 0.0, 0.0)
|
2024-02-23 01:53:49 -08:00
|
|
|
|
|
|
|
% The uint value is never casted to int on SM1-3, just casted to float and treated as such
|
|
|
|
[pixel shader]
|
|
|
|
float4 main() : SV_TARGET
|
|
|
|
{
|
|
|
|
int x = 3000000000u;
|
|
|
|
return float4(x, 0.0, 0.0, 0.0);
|
|
|
|
}
|
|
|
|
|
|
|
|
[test]
|
2021-08-19 13:00:58 -07:00
|
|
|
draw quad
|
2024-02-10 11:16:22 -08:00
|
|
|
if(sm<4) todo probe (0,0) rgba (3.0e+009, 0.0, 0.0, 0.0)
|
|
|
|
if(sm>=4) probe (0,0) rgba (-1.29496730e+009, 0.0, 0.0, 0.0)
|
2024-02-23 01:53:49 -08:00
|
|
|
|
|
|
|
% On SM1-5 (FXC) the literal is considered signed independently of its value and casted to uint;
|
|
|
|
% on SM1-3 compilation fails because the uint would be negative
|
|
|
|
[pixel shader fail(sm<4) todo(sm<4)]
|
|
|
|
float4 main() : SV_TARGET
|
|
|
|
{
|
|
|
|
uint x = 3000000000;
|
|
|
|
return float4(x, 0.0, 0.0, 0.0);
|
|
|
|
}
|
|
|
|
|
|
|
|
[test]
|
2021-08-19 13:00:58 -07:00
|
|
|
draw quad
|
2024-02-10 11:16:22 -08:00
|
|
|
if(sm>=4) probe (0,0) rgba (3.0e+009, 0.0, 0.0, 0.0)
|
2024-02-23 01:53:49 -08:00
|
|
|
|
|
|
|
[pixel shader]
|
|
|
|
float4 main() : SV_TARGET
|
|
|
|
{
|
|
|
|
int x = 3000000000;
|
|
|
|
return float4(x, 0.0, 0.0, 0.0);
|
|
|
|
}
|
|
|
|
|
|
|
|
[test]
|
2021-08-19 13:00:58 -07:00
|
|
|
draw quad
|
2024-02-10 11:16:22 -08:00
|
|
|
probe (0, 0) rgba (-1.29496730e+009, 0.0, 0.0, 0.0)
|
2024-02-23 01:53:49 -08:00
|
|
|
|
|
|
|
[pixel shader]
|
|
|
|
float4 main() : SV_TARGET
|
|
|
|
{
|
|
|
|
return float4(3000000000u, 0.0, 0.0, 0.0);
|
|
|
|
}
|
|
|
|
|
|
|
|
[test]
|
2021-08-19 13:00:58 -07:00
|
|
|
draw quad
|
2024-02-10 11:16:22 -08:00
|
|
|
probe (0, 0) rgba (3.0e+009, 0.0, 0.0, 0.0)
|
2024-02-23 01:53:49 -08:00
|
|
|
|
|
|
|
% Unsuffixed literals can instead be considered unsigned on SM6
|
|
|
|
[pixel shader]
|
|
|
|
float4 main() : SV_TARGET
|
|
|
|
{
|
|
|
|
return float4(3000000000, 0.0, 0.0, 0.0);
|
|
|
|
}
|
|
|
|
|
|
|
|
[test]
|
2021-08-19 13:00:58 -07:00
|
|
|
draw quad
|
2024-02-10 11:16:22 -08:00
|
|
|
if(sm<6) probe (0,0) rgba (-1.29496730e+009, 0.0, 0.0, 0.0)
|
|
|
|
if(sm>=6) probe (0,0) rgba (3.0e+009, 0.0, 0.0, 0.0)
|
2024-02-23 01:53:49 -08:00
|
|
|
|
|
|
|
% Constant folding is done with uint semantics before converting to float;
|
|
|
|
% so constant folding seems to happen before converting integer operations to floats
|
|
|
|
[pixel shader]
|
|
|
|
float4 main() : SV_TARGET
|
|
|
|
{
|
|
|
|
uint x = 3000000000u + 3000000000u;
|
|
|
|
return float4(x, 0.0, 0.0, 0.0);
|
|
|
|
}
|
|
|
|
|
|
|
|
[test]
|
2021-08-19 13:00:58 -07:00
|
|
|
draw quad
|
2024-02-10 11:16:22 -08:00
|
|
|
probe (0, 0) rgba (1.70503270e+009, 0.0, 0.0, 0.0)
|
2024-02-23 01:53:49 -08:00
|
|
|
|
|
|
|
% SM1-3 complains that uint values must be positive, but it's not clear why this is a problem here:
|
|
|
|
% the sum should be done before casting to uint, and the result of the int sum should be positive,
|
|
|
|
% so it seems that the declared type of x means something on how constant folding is done.
|
|
|
|
% I'm not sure what's happening for SM4 anyway
|
|
|
|
[pixel shader fail(sm<4) todo(sm<4)]
|
|
|
|
float4 main() : SV_TARGET
|
|
|
|
{
|
|
|
|
uint x = 3000000000 + 3000000000;
|
|
|
|
return float4(x, 0.0, 0.0, 0.0);
|
|
|
|
}
|
|
|
|
|
|
|
|
[test]
|
2021-08-19 13:00:58 -07:00
|
|
|
draw quad
|
2024-02-10 11:16:22 -08:00
|
|
|
todo probe (0,0) rgba (2.14748365e+009, 0.0, 0.0, 0.0)
|
2024-02-23 01:53:49 -08:00
|
|
|
|
|
|
|
% Again, no idea of what's happening here
|
|
|
|
[pixel shader]
|
|
|
|
float4 main() : SV_TARGET
|
|
|
|
{
|
|
|
|
int x = 3000000000 + 3000000000;
|
|
|
|
return float4(x, 0.0, 0.0, 0.0);
|
|
|
|
}
|
|
|
|
|
|
|
|
[test]
|
2021-08-19 13:00:58 -07:00
|
|
|
draw quad
|
2024-02-10 11:16:22 -08:00
|
|
|
todo probe (0,0) rgba (-2.14748365e+009, 0.0, 0.0, 0.0)
|
2024-02-23 01:53:49 -08:00
|
|
|
|
|
|
|
% This makes sense
|
|
|
|
[pixel shader]
|
|
|
|
float4 main() : SV_TARGET
|
|
|
|
{
|
|
|
|
return float4(3000000000u + 3000000000u, 0.0, 0.0, 0.0);
|
|
|
|
}
|
|
|
|
|
|
|
|
[test]
|
2021-08-19 13:00:58 -07:00
|
|
|
draw quad
|
2024-02-10 11:16:22 -08:00
|
|
|
probe (0, 0) rgba (1.70503270e+009, 0.0, 0.0, 0.0)
|
2024-02-23 01:53:49 -08:00
|
|
|
|
|
|
|
% This does not again
|
|
|
|
[pixel shader]
|
|
|
|
float4 main() : SV_TARGET
|
|
|
|
{
|
|
|
|
return float4(3000000000 + 3000000000, 0.0, 0.0, 0.0);
|
|
|
|
}
|
|
|
|
|
|
|
|
[test]
|
2021-08-19 13:00:58 -07:00
|
|
|
draw quad
|
2024-02-10 11:16:22 -08:00
|
|
|
todo probe (0,0) rgba (-2.14748365e+009, 0.0, 0.0, 0.0)
|
2024-02-23 01:53:49 -08:00
|
|
|
|
|
|
|
% Explicit float literals use float semantics, at least
|
|
|
|
[pixel shader]
|
|
|
|
float4 main() : SV_TARGET
|
|
|
|
{
|
|
|
|
float x = 3000000000.0 + 3000000000.0;
|
|
|
|
return float4(x, 0.0, 0.0, 0.0);
|
|
|
|
}
|
|
|
|
|
|
|
|
[test]
|
2021-08-19 13:00:58 -07:00
|
|
|
draw quad
|
2024-02-10 11:16:22 -08:00
|
|
|
probe (0, 0) rgba (6.0e+009, 0.0, 0.0, 0.0)
|