diff options
author | Clément Foucault <foucault.clem@gmail.com> | 2022-04-19 13:01:16 +0300 |
---|---|---|
committer | Clément Foucault <foucault.clem@gmail.com> | 2022-04-19 13:09:18 +0300 |
commit | fa3bd17ae87301ca198d16d2dc7d2432548f34f9 (patch) | |
tree | c08eb8740784799dd3bf9517f4eb4380bc4e6cab /source/blender/draw/intern/draw_manager.c | |
parent | 1e3f4c70ab56578b8b0e0056870bd17cc118982a (diff) |
GPU: Replace `GPUMaterialVolumeGrid` by `GPUMaterialAttribute`
This is to make the codegen and shading nodes object type agnostic. This
is essential for flexibility of the engine to use the nodetree as it see
fits.
The essential volume attributes struct properties are moved to the
`GPUMaterialAttribute` which see its final input name set on creation.
The binding process is centralized into `draw_volume.cc` to avoid
duplicating the code between multiple engines. It mimics the hair attributes
process.
Volume object grid transforms and other per object uniforms are packed into
one UBO per object. The grid transform is now based on object which simplify
the matrix preparations.
This also gets rid of the double transforms and use object info orco factors
for volume objects.
Tagging @brecht because he did the initial implementation of Volume Grids.
Diffstat (limited to 'source/blender/draw/intern/draw_manager.c')
-rw-r--r-- | source/blender/draw/intern/draw_manager.c | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/source/blender/draw/intern/draw_manager.c b/source/blender/draw/intern/draw_manager.c index 441628f2490..e0dfc29b966 100644 --- a/source/blender/draw/intern/draw_manager.c +++ b/source/blender/draw/intern/draw_manager.c @@ -478,6 +478,7 @@ void DRW_viewport_data_free(DRWData *drw_data) MEM_freeN(drw_data->matrices_ubo); MEM_freeN(drw_data->obinfos_ubo); } + DRW_volume_ubos_pool_free(drw_data->volume_grids_ubos); MEM_freeN(drw_data); } @@ -1650,6 +1651,7 @@ void DRW_draw_render_loop_ex(struct Depsgraph *depsgraph, drw_debug_init(); DRW_hair_init(); + DRW_volume_init(DST.vmempool); DRW_smoke_init(DST.vmempool); /* No frame-buffer allowed before drawing. */ @@ -2021,6 +2023,7 @@ void DRW_render_object_iter( { const DRWContextState *draw_ctx = DRW_context_state_get(); DRW_hair_init(); + DRW_volume_init(DST.vmempool); DRW_smoke_init(DST.vmempool); drw_task_graph_init(); @@ -2077,6 +2080,7 @@ void DRW_custom_pipeline(DrawEngineType *draw_engine_type, drw_manager_init(&DST, NULL, NULL); DRW_hair_init(); + DRW_volume_init(DST.vmempool); DRW_smoke_init(DST.vmempool); ViewportEngineData *data = DRW_view_data_engine_data_get_ensure(DST.view_data_active, @@ -2111,6 +2115,7 @@ void DRW_cache_restart(void) DST.buffer_finish_called = false; DRW_hair_init(); + DRW_volume_init(DST.vmempool); DRW_smoke_init(DST.vmempool); } @@ -2429,6 +2434,7 @@ void DRW_draw_select_loop(struct Depsgraph *depsgraph, /* Init engines */ drw_engines_init(); DRW_hair_init(); + DRW_volume_init(DST.vmempool); DRW_smoke_init(DST.vmempool); { @@ -2602,6 +2608,7 @@ static void drw_draw_depth_loop_impl(struct Depsgraph *depsgraph, /* Init engines */ drw_engines_init(); DRW_hair_init(); + DRW_volume_init(DST.vmempool); DRW_smoke_init(DST.vmempool); { @@ -3027,6 +3034,7 @@ void DRW_engines_free(void) DRW_shaders_free(); DRW_hair_free(); + DRW_volume_free(); DRW_shape_cache_free(); DRW_stats_free(); DRW_globals_free(); |