diff options
author | mano-wii <germano.costa@ig.com.br> | 2019-12-19 17:44:50 +0300 |
---|---|---|
committer | mano-wii <germano.costa@ig.com.br> | 2019-12-19 17:45:02 +0300 |
commit | 26e4f4a8c475049e9600d466bb95eed341202f57 (patch) | |
tree | 3f27ffcabf2dcf5cc0ce8a60f313d0b070c09858 /source/blender/gpu | |
parent | 56fc0f411fb5c8b71d916d834c5435e667d14d1a (diff) |
Fix T71795: Unproject with high clipping range sometimes results in nans
Differential Revision: https://developer.blender.org/D6311
Diffstat (limited to 'source/blender/gpu')
-rw-r--r-- | source/blender/gpu/intern/gpu_matrix.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/source/blender/gpu/intern/gpu_matrix.c b/source/blender/gpu/intern/gpu_matrix.c index fb0dffb58d1..5e44a950ba7 100644 --- a/source/blender/gpu/intern/gpu_matrix.c +++ b/source/blender/gpu/intern/gpu_matrix.c @@ -535,6 +535,11 @@ bool GPU_matrix_unproject_precalc(struct GPUMatrixUnproject_Precalc *precalc, &precalc->dims.ymax, &precalc->dims.zmin, &precalc->dims.zmax); + if (isinf(precalc->dims.zmax)) { + /* We cannot retrieve the actual value of the clip_end. + * Use `FLT_MAX` to avoid nans. */ + precalc->dims.zmax = FLT_MAX; + } for (int i = 0; i < 4; i++) { precalc->view[i] = (float)view[i]; } |