diff options
author | Germano Cavalcante <mano-wii> | 2021-06-21 22:25:53 +0300 |
---|---|---|
committer | Germano Cavalcante <germano.costa@ig.com.br> | 2021-06-21 22:41:50 +0300 |
commit | b11a463e4fcd98f2fff6e05a03e97e71b93b8274 (patch) | |
tree | 6d6e3a294e19c75f3dfe2f9a1d06ab96875be04f /source/blender/editors/include/ED_view3d.h | |
parent | b665ad8621a0db265fd666542d26aed463025db1 (diff) |
Refactor: Do not keep a copy of depth buffer in RegionView3D
The depth cache (located in `RegionView3D::depths`) is used for quick
and simple occlusion testing in:
- particle selection,
- "Draw Curve" operator and
- "Interactive Light Track to Cursor" operator,
However, keeping a texture buffer in cache is not a recommended practice.
For displays with high resolution like 8k this represents something
around 132MB.
Also, currently, each call to `ED_view3d_depth_override` invalidates
the depth cache. So that depth is never reused in multiple calls from
an operator (this was not the case in blender 2.79).
This commit allows to create a depth cache and release it in the same
operator. Thus, the buffer is kept in cache for a short time, freeing
up space.
No functional changes.
Diffstat (limited to 'source/blender/editors/include/ED_view3d.h')
-rw-r--r-- | source/blender/editors/include/ED_view3d.h | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/source/blender/editors/include/ED_view3d.h b/source/blender/editors/include/ED_view3d.h index d86041aa6e8..64883ed5f1d 100644 --- a/source/blender/editors/include/ED_view3d.h +++ b/source/blender/editors/include/ED_view3d.h @@ -90,8 +90,6 @@ typedef struct ViewDepths { short x, y; /* only for temp use for sub-rects, added to region->winx/y */ float *depths; double depth_range[2]; - - bool damaged; } ViewDepths; /* Rotate 3D cursor on placement. */ @@ -154,19 +152,20 @@ void ED_view3d_depth_override(struct Depsgraph *depsgraph, struct View3D *v3d, struct Object *obact, eV3DDepthOverrideMode mode, - bool update_cache); + struct ViewDepths **r_depths); +void ED_view3d_depths_free(ViewDepths *depths); bool ED_view3d_depth_read_cached(const ViewDepths *vd, const int mval[2], int margin, float *r_depth); -bool ED_view3d_depth_read_cached_normal(const ViewContext *vc, +bool ED_view3d_depth_read_cached_normal(const struct ARegion *region, + const ViewDepths *depths, const int mval[2], float r_normal[3]); bool ED_view3d_depth_unproject_v3(const struct ARegion *region, const int mval[2], const double depth, float r_location_world[3]); -void ED_view3d_depth_tag_update(struct RegionView3D *rv3d); /* Projection */ #define IS_CLIPPED 12000 |