Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2020-07-19 14:27:13 +0300
committerCampbell Barton <ideasman42@gmail.com>2020-07-19 14:27:13 +0300
commit8c90910dcc3ac56ecaa3f0d0ed1a43a423ff687f (patch)
tree713ac786e3470efe7f3e04625e5b4945d274f042 /source/blender/gpu
parentccd2af43b3ab83dc873010faade1b2916553291a (diff)
Fix T66937: Blank view on navigation with auto-deph & large clip-end
Diffstat (limited to 'source/blender/gpu')
-rw-r--r--source/blender/gpu/GPU_matrix.h12
-rw-r--r--source/blender/gpu/intern/gpu_matrix.c14
2 files changed, 15 insertions, 11 deletions
diff --git a/source/blender/gpu/GPU_matrix.h b/source/blender/gpu/GPU_matrix.h
index 56d640ea0e4..eabfb5d2dc3 100644
--- a/source/blender/gpu/GPU_matrix.h
+++ b/source/blender/gpu/GPU_matrix.h
@@ -102,11 +102,15 @@ struct GPUMatrixUnproject_Precalc {
float model_inverted[4][4];
float view[4];
bool is_persp;
- /** Result of 'projmat_dimensions'. */
+ /**
+ * Result of #projmat_dimensions_db.
+ * Using double precision here is important as far clipping ranges
+ * can cause divide-by-zero when using float, see: T66937.
+ */
struct {
- float xmin, xmax;
- float ymin, ymax;
- float zmin, zmax;
+ double xmin, xmax;
+ double ymin, ymax;
+ double zmin, zmax;
} dims;
};
diff --git a/source/blender/gpu/intern/gpu_matrix.c b/source/blender/gpu/intern/gpu_matrix.c
index d0f7eab32a3..669bf56b726 100644
--- a/source/blender/gpu/intern/gpu_matrix.c
+++ b/source/blender/gpu/intern/gpu_matrix.c
@@ -536,13 +536,13 @@ bool GPU_matrix_unproject_precalc(struct GPUMatrixUnproject_Precalc *precalc,
const int view[4])
{
precalc->is_persp = proj[3][3] == 0.0f;
- projmat_dimensions(proj,
- &precalc->dims.xmin,
- &precalc->dims.xmax,
- &precalc->dims.ymin,
- &precalc->dims.ymax,
- &precalc->dims.zmin,
- &precalc->dims.zmax);
+ projmat_dimensions_db(proj,
+ &precalc->dims.xmin,
+ &precalc->dims.xmax,
+ &precalc->dims.ymin,
+ &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. */