diff options
author | Sebastián Barschkis <sebbas@sebbas.org> | 2020-09-11 17:45:07 +0300 |
---|---|---|
committer | Sebastián Barschkis <sebbas@sebbas.org> | 2020-09-11 19:57:56 +0300 |
commit | 1e3057f17779eb6c9fc03ba07a06332984a35cd7 (patch) | |
tree | aed9acadf4e7d2dea60a20ed7cbb0324c18dbddd /source/blender/draw/intern | |
parent | ad70d4b0956f5f06f45414cdfae2e2dc19505d71 (diff) |
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
Diffstat (limited to 'source/blender/draw/intern')
-rw-r--r-- | source/blender/draw/intern/draw_fluid.c | 8 |
1 files changed, 8 insertions, 0 deletions
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; |