diff options
author | Brecht Van Lommel <brecht@blender.org> | 2020-09-03 17:08:27 +0300 |
---|---|---|
committer | Brecht Van Lommel <brecht@blender.org> | 2020-09-03 17:12:30 +0300 |
commit | e7d3d0219b39ef5e8ff0308ef7dc6463770daca2 (patch) | |
tree | 38bb880e301f679a3ce817afcbb2c3feb9514f88 /source/blender/draw/engines | |
parent | f0c376a52a53db98bd8d8db3c79116f71001fb5c (diff) |
Fix T79718: Eevee OpenVDB render error when frames miss part of the grids
Improved fix that handles the distinct cases of missing grids and zero
size grids.
Diffstat (limited to 'source/blender/draw/engines')
-rw-r--r-- | source/blender/draw/engines/eevee/eevee_volumes.c | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/source/blender/draw/engines/eevee/eevee_volumes.c b/source/blender/draw/engines/eevee/eevee_volumes.c index 4a0eaf2698a..3caca0275c3 100644 --- a/source/blender/draw/engines/eevee/eevee_volumes.c +++ b/source/blender/draw/engines/eevee/eevee_volumes.c @@ -154,6 +154,8 @@ static GPUTexture *eevee_volume_default_texture(eGPUVolumeDefaultValue default_v case GPU_VOLUME_DEFAULT_1: return e_data.dummy_one; } + + return e_data.dummy_zero; } void EEVEE_volumes_set_jitter(EEVEE_ViewLayerData *sldata, uint current_sample) @@ -458,10 +460,16 @@ static bool eevee_volume_object_grids_init(Object *ob, ListBase *gpu_grids, DRWS DRW_volume_batch_cache_get_grid(volume, volume_grid) : NULL; - DRW_shgroup_uniform_texture( - grp, - gpu_grid->sampler_name, - (drw_grid) ? drw_grid->texture : eevee_volume_default_texture(gpu_grid->default_value)); + /* Handle 3 cases here: + * - Grid exists and texture was loaded -> use texture. + * - Grid exists but has zero size or failed to load -> use zero. + * - Grid does not exist -> use default value. */ + GPUTexture *grid_tex = (drw_grid) ? drw_grid->texture : + (volume_grid) ? + e_data.dummy_zero : + eevee_volume_default_texture(gpu_grid->default_value); + + DRW_shgroup_uniform_texture(grp, gpu_grid->sampler_name, grid_tex); if (drw_grid && multiple_transforms) { /* Specify per-volume transform matrix that is applied after the |