Page MenuHome

Crash when switching to in-progress render slot (2.91)
Closed, DuplicatePublicBUG

Description

System Information
Operating system: Darwin-17.7.0-x86_64-i386-64bit 64 Bits
Graphics card: Intel(R) HD Graphics 6000 Intel Inc. 4.1 INTEL-10.36.23

Blender Version
Broken: version: 2.91.0, branch: master, commit date: 2020-11-25 08:34, hash: rB0f45cab862b8
Worked: 2.90.1

Short description of error
While a render is in progress, switching to that render slot sometimes causes a crash. It seems to happen more often if you switch between render slots in quick succession.

Exact steps for others to reproduce the error

  1. Set render engine to cycles
  2. Begin render
  3. While render is in progress, switch back and forth between the in-progress render slot and any other render slot

Event Timeline

Philipp Oeser (lichtwerk) changed the task status from Needs Triage to Confirmed.Nov 30 2020, 11:24 AM
Philipp Oeser (lichtwerk) triaged this task as High priority.
Philipp Oeser (lichtwerk) changed the subtype of this task from "Report" to "Bug".

@Jeroen Bakker (jbakker): does this ring a bell?

IMB_create_gpu_texture can end up returning invalid pointer in image_get_gpu_texture, from there on things go downhill...

1  blender::gpu::Texture::format_flag_get gpu_texture_private.hh 220  0xc73bf24 
2  GPU_texture_mipmap_mode                gpu_texture.cc         481  0xc73b828 
3  image_get_gpu_texture                  image_gpu.c            368  0x335661d 
4  BKE_image_get_gpu_texture              image_gpu.c            387  0x33566ac 
5  space_image_gpu_texture_get            image_engine.c         139  0x3b5e602 
6  image_gpu_texture_get                  image_engine.c         172  0x3b5e6d4 
7  image_cache_image                      image_engine.c         191  0x3b5e7a8 
8  IMAGE_cache_init                       image_engine.c         326  0x3b5edab 
9  drw_engines_cache_init                 draw_manager.c         1050 0x3b454f7 
10 DRW_draw_render_loop_2d_ex             draw_manager.c         2100 0x3b47d92 
11 DRW_draw_view                          draw_manager.c         1518 0x3b46771 
12 image_main_region_draw                 space_image.c          657  0x474c78b 
13 ED_region_do_draw                      area.c                 546  0x41238e9 
14 wm_draw_window_offscreen               wm_draw.c              731  0x3871052 
15 wm_draw_window                         wm_draw.c              872  0x387160b 
16 wm_draw_update                         wm_draw.c              1073 0x3871c43 
17 WM_main                                wm.c                   641  0x386e661 
18 main                                   creator.c              522  0x32f7682

It seems to me that the pointer returned by IMB_create_gpu_texture is still fine. *tex is set to null a couple lines later in GPU_texture_generate_mipmap. I'm don't know how that happens yet.

This crashes on the second assert, when I quickly switch between slot 1 and 2 during rendering.

diff --git a/source/blender/blenkernel/intern/image_gpu.c b/source/blender/blenkernel/intern/image_gpu.c
index 05aa3c89a84..18ef587fc1f 100644
--- a/source/blender/blenkernel/intern/image_gpu.c
+++ b/source/blender/blenkernel/intern/image_gpu.c
@@ -387,7 +387,9 @@ static GPUTexture *image_get_gpu_texture(Image *ima,
     GPU_texture_wrap_mode(*tex, true, false);
 
     if (GPU_mipmap_enabled()) {
+      BLI_assert(*tex != NULL);
       GPU_texture_generate_mipmap(*tex);
+      BLI_assert(*tex != NULL);
       if (ima) {
         ima->gpuflag |= IMA_GPU_MIPMAP_COMPLETE;
       }

I assume T84398: Multiview images show only one view is somewhat related, there *tex is borked due to "misuse" of get_image_gpu_texture_ptr

There are several crash reports involving 2 scenes composited together that also crash in GPU mipmapping, I’ll hunt them down in the next hour-ish.