Commit: 1e3057f17779eb6c9fc03ba07a06332984a35cd7
Author: Sebastián Barschkis
Date:   Fri Sep 11 16:45:07 2020 +0200
Branches: master
https://developer.blender.org/rB1e3057f17779eb6c9fc03ba07a06332984a35cd7

GPUTexture: Return NULL texture if data grid is NULL too

In a recent update to the fluids modifier (rB03c2439d96e8), I introduced a 
flush call that sets all grids to NULL if the frame is outside of the allowed 
frame range. This way, the texture creation function must also check if the 
data grid is NULL before trying to create a texture.

Reviewed By: fclem

Differential Revision: https://developer.blender.org/D8872

===================================================================

M       source/blender/draw/intern/draw_fluid.c

===================================================================

diff --git a/source/blender/draw/intern/draw_fluid.c 
b/source/blender/draw/intern/draw_fluid.c
index af14f11e6e9..809512bd7dd 100644
--- a/source/blender/draw/intern/draw_fluid.c
+++ b/source/blender/draw/intern/draw_fluid.c
@@ -183,6 +183,10 @@ static GPUTexture *create_volume_texture(const int dim[3],
   GPUTexture *tex = NULL;
   int final_dim[3] = {UNPACK3(dim)};
 
+  if (data == NULL) {
+    return NULL;
+  }
+
   while (1) {
     tex = GPU_texture_create_3d("volume", UNPACK3(final_dim), 1, format, NULL);
 
@@ -292,6 +296,10 @@ static GPUTexture 
*create_density_texture(FluidDomainSettings *fds, int highres)
     data = manta_smoke_get_density(fds->fluid);
   }
 
+  if (data == NULL) {
+    return NULL;
+  }
+
   GPUTexture *tex = create_volume_texture(dim, GPU_R8, data);
   swizzle_texture_channel_single(tex);
   return tex;

_______________________________________________
Bf-blender-cvs mailing list
[email protected]
https://lists.blender.org/mailman/listinfo/bf-blender-cvs

Reply via email to