Fix issues with float inaccuracy on 'clipping' overlay

* There was a problem where a value of 1.0 would show up as 'clipping' if
  the range meant that it was transformed to something like 1.0000000432f
  so we use FLT_EPSILON as a slight fudge factor.
This commit is contained in:
baldurk
2014-11-02 21:19:48 +00:00
parent ad2b26b238
commit facea8d019
2 changed files with 4 additions and 1 deletions
+3
View File
@@ -139,6 +139,9 @@ cbuffer HistogramCBufferData REG(b0)
#define TEXDISPLAY_SINT_TEX 0x0800
#define TEXDISPLAY_GAMMA_CURVE 0x1000
#ifndef FLT_EPSILON
#define FLT_EPSILON 1.192092896e-07f
#endif
// histogram/minmax is calculated in blocks of NxN each with MxM tiles.
// e.g. a tile is 32x32 pixels, then this is arranged in blocks of 32x32 tiles.
+1 -1
View File
@@ -137,7 +137,7 @@ float4 RENDERDOC_TexDisplayPS(v2f IN) : SV_Target0
if(col.r < 0 || col.g < 0 || col.b < 0 || col.a < 0)
return float4(1, 0, 0, 1);
if(col.r > 1 || col.g > 1 || col.b > 1 || col.a > 1)
if(col.r > (1+FLT_EPSILON) || col.g > (1+FLT_EPSILON) || col.b > (1+FLT_EPSILON) || col.a > (1+FLT_EPSILON))
return float4(0, 1, 0, 1);
col = float4(dot(col.xyz, float3(0.2126, 0.7152, 0.0722)).xxx, 1);