Fix T66860 Crash on opening .blend file from 2.79
authorClément Foucault <foucault.clem@gmail.com>
Mon, 15 Jul 2019 11:07:42 +0000 (13:07 +0200)
committerClément Foucault <foucault.clem@gmail.com>
Mon, 15 Jul 2019 11:07:42 +0000 (13:07 +0200)
This was caused by the preview render of the material property panel being
1px wide. The computed half buffers width were rounded to 0.

source/blender/draw/engines/eevee/eevee_depth_of_field.c
source/blender/draw/engines/eevee/eevee_screen_raytrace.c
source/blender/draw/engines/workbench/workbench_effect_dof.c

index d0f544dd3c635c393d72d59c9b3891b58ee78dc9..12d70131031525f09e32616bbe3d77fb2dffa7f2 100644 (file)
@@ -97,6 +97,9 @@ int EEVEE_depth_of_field_init(EEVEE_ViewLayerData *UNUSED(sldata),
 
     int buffer_size[2] = {(int)viewport_size[0] / 2, (int)viewport_size[1] / 2};
 
+    buffer_size[0] = max_ii(1, buffer_size[0]);
+    buffer_size[1] = max_ii(1, buffer_size[1]);
+
     eGPUTextureFormat down_format = DRW_state_draw_background() ? GPU_R11F_G11F_B10F : GPU_RGBA16F;
 
     effects->dof_down_near = DRW_texture_pool_query_2d(
index 7b470f9c42a7ad2aaacb07e6ef825b99fd518723..d53ed239f4e10ede7c9927cecd70869e54933b82 100644 (file)
@@ -159,6 +159,9 @@ int EEVEE_screen_raytrace_init(EEVEE_ViewLayerData *sldata, EEVEE_Data *vedata)
     const bool high_qual_input = true; /* TODO dither low quality input */
     const eGPUTextureFormat format = (high_qual_input) ? GPU_RGBA16F : GPU_RGBA8;
 
+    tracing_res[0] = max_ii(1, tracing_res[0]);
+    tracing_res[1] = max_ii(1, tracing_res[1]);
+
     /* MRT for the shading pass in order to output needed data for the SSR pass. */
     effects->ssr_specrough_input = DRW_texture_pool_query_2d(
         size_fs[0], size_fs[1], format, &draw_engine_eevee_type);
index 69d0500f155b0d4516142875dfdb120efe38e1e7..22840a2a756af8c44ac51211501ed3224750be40 100644 (file)
@@ -173,7 +173,7 @@ void workbench_dof_engine_init(WORKBENCH_Data *vedata, Object *camera)
   }
 
   const float *full_size = DRW_viewport_size_get();
-  int size[2] = {full_size[0] / 2, full_size[1] / 2};
+  int size[2] = {max_ii(1, (int)full_size[0] / 2), max_ii(1, (int)full_size[1] / 2)};
 #if 0
   /* NOTE: We Ceil here in order to not miss any edge texel if using a NPO2 texture.  */
   int shrink_h_size[2] = {ceilf(size[0] / 8.0f), size[1]};