diff options
Diffstat (limited to 'source/blender/draw')
-rw-r--r-- | source/blender/draw/engines/eevee/eevee_volumes.c | 11 | ||||
-rw-r--r-- | source/blender/draw/engines/workbench/workbench_volume.c | 2 | ||||
-rw-r--r-- | source/blender/draw/intern/draw_cache.h | 3 | ||||
-rw-r--r-- | source/blender/draw/intern/draw_cache_impl_volume.c | 10 |
4 files changed, 13 insertions, 13 deletions
diff --git a/source/blender/draw/engines/eevee/eevee_volumes.c b/source/blender/draw/engines/eevee/eevee_volumes.c index aee260a542e..2d84c87106c 100644 --- a/source/blender/draw/engines/eevee/eevee_volumes.c +++ b/source/blender/draw/engines/eevee/eevee_volumes.c @@ -332,7 +332,7 @@ static bool eevee_volume_object_grids_init(Object *ob, ListBase *gpu_grids, DRWS bool multiple_transforms = true; LISTBASE_FOREACH (GPUMaterialVolumeGrid *, gpu_grid, gpu_grids) { - VolumeGrid *volume_grid = BKE_volume_grid_find(volume, gpu_grid->name); + const VolumeGrid *volume_grid = BKE_volume_grid_find_for_read(volume, gpu_grid->name); DRWVolumeGrid *drw_grid = (volume_grid) ? DRW_volume_batch_cache_get_grid(volume, volume_grid) : NULL; @@ -385,7 +385,7 @@ static bool eevee_volume_object_grids_init(Object *ob, ListBase *gpu_grids, DRWS /* Bind volume grid textures. */ LISTBASE_FOREACH (GPUMaterialVolumeGrid *, gpu_grid, gpu_grids) { - VolumeGrid *volume_grid = BKE_volume_grid_find(volume, gpu_grid->name); + const VolumeGrid *volume_grid = BKE_volume_grid_find_for_read(volume, gpu_grid->name); DRWVolumeGrid *drw_grid = (volume_grid) ? DRW_volume_batch_cache_get_grid(volume, volume_grid) : NULL; @@ -394,10 +394,9 @@ static bool eevee_volume_object_grids_init(Object *ob, ListBase *gpu_grids, DRWS * - 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); + 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); diff --git a/source/blender/draw/engines/workbench/workbench_volume.c b/source/blender/draw/engines/workbench/workbench_volume.c index c76f4a4c470..525a81b5581 100644 --- a/source/blender/draw/engines/workbench/workbench_volume.c +++ b/source/blender/draw/engines/workbench/workbench_volume.c @@ -215,7 +215,7 @@ static void workbench_volume_object_cache_populate(WORKBENCH_Data *vedata, /* Create 3D textures. */ Volume *volume = ob->data; BKE_volume_load(volume, G.main); - VolumeGrid *volume_grid = BKE_volume_grid_active_get(volume); + const VolumeGrid *volume_grid = BKE_volume_grid_active_get_for_read(volume); if (volume_grid == NULL) { return; } diff --git a/source/blender/draw/intern/draw_cache.h b/source/blender/draw/intern/draw_cache.h index c15c246992d..c58dd85b6ed 100644 --- a/source/blender/draw/intern/draw_cache.h +++ b/source/blender/draw/intern/draw_cache.h @@ -244,7 +244,8 @@ typedef struct DRWVolumeGrid { float bounds_to_texture[4][4]; } DRWVolumeGrid; -DRWVolumeGrid *DRW_volume_batch_cache_get_grid(struct Volume *volume, struct VolumeGrid *grid); +DRWVolumeGrid *DRW_volume_batch_cache_get_grid(struct Volume *volume, + const struct VolumeGrid *grid); struct GPUBatch *DRW_cache_volume_face_wireframe_get(struct Object *ob); struct GPUBatch *DRW_cache_volume_selection_surface_get(struct Object *ob); diff --git a/source/blender/draw/intern/draw_cache_impl_volume.c b/source/blender/draw/intern/draw_cache_impl_volume.c index 7244dfd12c3..52ebf1b239e 100644 --- a/source/blender/draw/intern/draw_cache_impl_volume.c +++ b/source/blender/draw/intern/draw_cache_impl_volume.c @@ -225,7 +225,7 @@ GPUBatch *DRW_volume_batch_cache_get_wireframes_face(Volume *volume) VolumeBatchCache *cache = volume_batch_cache_get(volume); if (cache->face_wire.batch == NULL) { - VolumeGrid *volume_grid = BKE_volume_grid_active_get(volume); + const VolumeGrid *volume_grid = BKE_volume_grid_active_get_for_read(volume); if (volume_grid == NULL) { return NULL; } @@ -274,7 +274,7 @@ GPUBatch *DRW_volume_batch_cache_get_selection_surface(Volume *volume) { VolumeBatchCache *cache = volume_batch_cache_get(volume); if (cache->selection_surface == NULL) { - VolumeGrid *volume_grid = BKE_volume_grid_active_get(volume); + const VolumeGrid *volume_grid = BKE_volume_grid_active_get_for_read(volume); if (volume_grid == NULL) { return NULL; } @@ -284,8 +284,8 @@ GPUBatch *DRW_volume_batch_cache_get_selection_surface(Volume *volume) return cache->selection_surface; } -static DRWVolumeGrid *volume_grid_cache_get(Volume *volume, - VolumeGrid *grid, +static DRWVolumeGrid *volume_grid_cache_get(const Volume *volume, + const VolumeGrid *grid, VolumeBatchCache *cache) { const char *name = BKE_volume_grid_name(grid); @@ -351,7 +351,7 @@ static DRWVolumeGrid *volume_grid_cache_get(Volume *volume, return cache_grid; } -DRWVolumeGrid *DRW_volume_batch_cache_get_grid(Volume *volume, VolumeGrid *volume_grid) +DRWVolumeGrid *DRW_volume_batch_cache_get_grid(Volume *volume, const VolumeGrid *volume_grid) { VolumeBatchCache *cache = volume_batch_cache_get(volume); DRWVolumeGrid *grid = volume_grid_cache_get(volume, volume_grid, cache); |