Do NaN/-ve/inf checks before range application, feels more consistent

* Before, we'd remap the visible range (if the range was 0.25-0.75 this
  meant 0.0 would be mapped to 'negative') before checking on negative
  values, which didn't feel like the right thing for the overlay to show.
This commit is contained in:
baldurk
2014-11-03 00:50:46 +00:00
parent 93f4141abd
commit b590377345
2 changed files with 12 additions and 6 deletions
+6 -3
View File
@@ -95,26 +95,29 @@ void main(void)
else if (sintTex)
col = vec4(scol);
vec4 pre_range_col = col;
col = ((col - RangeMinimum)*InverseRangeSize);
col = mix(vec4(0,0,0,1), col, Channels);
pre_range_col = mix(vec4(0,0,0,1), pre_range_col, Channels);
// show nans, infs and negatives
if((OutputDisplayFormat & TEXDISPLAY_NANS) > 0)
{
if(isnan(col.r) || isnan(col.g) || isnan(col.b) || isnan(col.a))
if(isnan(pre_range_col.r) || isnan(pre_range_col.g) || isnan(pre_range_col.b) || isnan(pre_range_col.a))
{
color_out = vec4(1, 0, 0, 1);
return;
}
if(isinf(col.r) || isinf(col.g) || isinf(col.b) || isinf(col.a))
if(isinf(pre_range_col.r) || isinf(pre_range_col.g) || isinf(pre_range_col.b) || isinf(pre_range_col.a))
{
color_out = vec4(0, 1, 0, 1);
return;
}
if(col.r < 0 || col.g < 0 || col.b < 0 || col.a < 0)
if(pre_range_col.r < 0 || pre_range_col.g < 0 || pre_range_col.b < 0 || pre_range_col.a < 0)
{
color_out = vec4(0, 0, 1, 1);
return;
+6 -3
View File
@@ -114,20 +114,23 @@ float4 RENDERDOC_TexDisplayPS(v2f IN) : SV_Target0
else if(sintTex)
col = (float4)(scol);
float4 pre_range_col = col;
col = ((col - RangeMinimum)*InverseRangeSize);
col = lerp(float4(0,0,0,1), col, Channels);
pre_range_col = lerp(float4(0,0,0,1), pre_range_col, Channels);
// show nans, infs and negatives
if(OutputDisplayFormat & TEXDISPLAY_NANS)
{
if(isnan(col.r) || isnan(col.g) || isnan(col.b) || isnan(col.a))
if(isnan(pre_range_col.r) || isnan(pre_range_col.g) || isnan(pre_range_col.b) || isnan(pre_range_col.a))
return float4(1, 0, 0, 1);
if(isinf(col.r) || isinf(col.g) || isinf(col.b) || isinf(col.a))
if(isinf(pre_range_col.r) || isinf(pre_range_col.g) || isinf(pre_range_col.b) || isinf(pre_range_col.a))
return float4(0, 1, 0, 1);
if(col.r < 0 || col.g < 0 || col.b < 0 || col.a < 0)
if(pre_range_col.r < 0 || pre_range_col.g < 0 || pre_range_col.b < 0 || pre_range_col.a < 0)
return float4(0, 0, 1, 1);
col = float4(dot(col.xyz, float3(0.2126, 0.7152, 0.0722)).xxx, 1);