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:
authorClément Foucault <foucault.clem@gmail.com>2021-10-12 15:43:41 +0300
committerClément Foucault <foucault.clem@gmail.com>2021-10-12 17:47:42 +0300
commit45f167237f0cbebfed95e8b58b405367070ac305 (patch)
tree54aa790cda4540ed4bd7c980c1d7466836c3c105 /source/blender/editors/space_view3d/view3d_draw.c
parent6535779c92b90035870047f178cf3eff95f0bdf0 (diff)
Fix T91981: Crash when using operators that needs scene depth
There was a double lock in the object depth drawing function. Also the texture read was not reading the texture with the right format. Now it needs a conversion. Fix T91981 Particle Edit make Blender Crash Fix T92006 Light spot interactively point can't use
Diffstat (limited to 'source/blender/editors/space_view3d/view3d_draw.c')
-rw-r--r--source/blender/editors/space_view3d/view3d_draw.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/source/blender/editors/space_view3d/view3d_draw.c b/source/blender/editors/space_view3d/view3d_draw.c
index 151fa02cd5c..fe347e89600 100644
--- a/source/blender/editors/space_view3d/view3d_draw.c
+++ b/source/blender/editors/space_view3d/view3d_draw.c
@@ -2297,8 +2297,13 @@ static ViewDepths *view3d_depths_create(ARegion *region)
{
GPUViewport *viewport = WM_draw_region_get_viewport(region);
GPUTexture *depth_tx = GPU_viewport_depth_texture(viewport);
- d->depths = GPU_texture_read(depth_tx, GPU_DATA_FLOAT, 0);
-
+ uint32_t *int_depths = GPU_texture_read(depth_tx, GPU_DATA_UINT_24_8, 0);
+ d->depths = (float *)int_depths;
+ /* Convert in-place. */
+ int pixel_count = GPU_texture_width(depth_tx) * GPU_texture_height(depth_tx);
+ for (int i = 0; i < pixel_count; i++) {
+ d->depths[i] = (int_depths[i] >> 8u) / (float)0xFFFFFF;
+ }
/* Assumed to be this as they are never changed. */
d->depth_range[0] = 0.0;
d->depth_range[1] = 1.0;