diff options
author | Clément Foucault <foucault.clem@gmail.com> | 2022-08-30 21:00:51 +0300 |
---|---|---|
committer | Clément Foucault <foucault.clem@gmail.com> | 2022-08-30 21:00:51 +0300 |
commit | 853d49d75417f38d58da7b978693d8cda400e01f (patch) | |
tree | 0d28604847ca8c5ae2ee26f79c87af0e60a2da36 /source | |
parent | 26692cb7e74108185f70f331d0914f8ed139e7a0 (diff) |
DRW: Allow drawing without any draw view
Diffstat (limited to 'source')
-rw-r--r-- | source/blender/draw/intern/draw_command.cc | 5 | ||||
-rw-r--r-- | source/blender/draw/intern/draw_command.hh | 11 | ||||
-rw-r--r-- | source/blender/draw/intern/draw_manager.cc | 19 | ||||
-rw-r--r-- | source/blender/draw/intern/draw_manager.hh | 4 |
4 files changed, 28 insertions, 11 deletions
diff --git a/source/blender/draw/intern/draw_command.cc b/source/blender/draw/intern/draw_command.cc index 3a2afa0e5b7..51dd2c2ed11 100644 --- a/source/blender/draw/intern/draw_command.cc +++ b/source/blender/draw/intern/draw_command.cc @@ -480,10 +480,9 @@ std::string StencilSet::serialize() const void DrawCommandBuf::bind(RecordingState &state, Vector<Header, 0> &headers, - Vector<Undetermined, 0> &commands, - VisibilityBuf &visibility_buf) + Vector<Undetermined, 0> &commands) { - UNUSED_VARS(headers, commands, visibility_buf); + UNUSED_VARS(headers, commands); resource_id_count_ = 0; diff --git a/source/blender/draw/intern/draw_command.hh b/source/blender/draw/intern/draw_command.hh index fc0060c910a..209e3117aa5 100644 --- a/source/blender/draw/intern/draw_command.hh +++ b/source/blender/draw/intern/draw_command.hh @@ -385,10 +385,7 @@ class DrawCommandBuf { commands[index].draw = {batch, instance_len, vertex_len, vertex_first, handle}; } - void bind(RecordingState &state, - Vector<Header, 0> &headers, - Vector<Undetermined, 0> &commands, - VisibilityBuf &visibility_buf); + void bind(RecordingState &state, Vector<Header, 0> &headers, Vector<Undetermined, 0> &commands); }; /** \} */ @@ -414,16 +411,16 @@ class DrawCommandBuf { * | Command1 | Command2 | < Command::Header | * | GPUBatch1 | GPUBatch2 | GPUBatch1 | < Command::MultiDraw | * | 1 | 0 0 | 0 0 0 | 1 1 | < Front facing inverted | - * | MDI | MDI | MDI | MDI | < MultiDrawIndirect emitted | + * | MDI | MDI | MDI | MDI | < DrawIndirect emitted | * +---------------------------------------------------------------+------------------------------+ * | GPU Timeline | Granularity | * +---------------------------------------------------------------+------------------------------+ - * | 4 | 2 5 | 1 | 3 4 | 6 7 | < Resource_id (sorted) | + * | 4 | 2 5 | 1 3 4 | 6 7 | < Resource_id (sorted) | * | 1 | 1 1 | 1 | 0 | 1 | 1 1 | < Visibility test result | * | 4 | 2 + 5 | 1 + 4 | 6+7 | < DrawCommand (compacted) | * +---------------------------------------------------------------+------------------------------+ * - * In the example above, we will issue 4 multi draw indirect calls. + * In the example above, we will issue 4 draw indirect calls. * * \{ */ diff --git a/source/blender/draw/intern/draw_manager.cc b/source/blender/draw/intern/draw_manager.cc index 20a9a9e8c36..8fb2ffb39e8 100644 --- a/source/blender/draw/intern/draw_manager.cc +++ b/source/blender/draw/intern/draw_manager.cc @@ -99,7 +99,7 @@ void Manager::submit(PassSimple &pass, View &view) command::RecordingState state; state.inverted_view = view.is_inverted(); - pass.draw_commands_buf_.bind(state, pass.headers_, pass.commands_, view.visibility_buf_); + pass.draw_commands_buf_.bind(state, pass.headers_, pass.commands_); GPU_storagebuf_bind(matrix_buf, DRW_OBJ_MAT_SLOT); GPU_storagebuf_bind(infos_buf, DRW_OBJ_INFOS_SLOT); @@ -142,6 +142,23 @@ void Manager::submit(PassSortable &pass, View &view) this->submit(static_cast<PassMain &>(pass), view); } +void Manager::submit(PassSimple &pass) +{ + debug_bind(); + + command::RecordingState state; + + pass.draw_commands_buf_.bind(state, pass.headers_, pass.commands_); + + GPU_storagebuf_bind(matrix_buf, DRW_OBJ_MAT_SLOT); + GPU_storagebuf_bind(infos_buf, DRW_OBJ_INFOS_SLOT); + // GPU_storagebuf_bind(attribute_buf, DRW_OBJ_ATTR_SLOT); /* TODO */ + + pass.submit(state); + + state.cleanup(); +} + Manager::SubmitDebugOutput Manager::submit_debug(PassSimple &pass, View &view) { submit(pass, view); diff --git a/source/blender/draw/intern/draw_manager.hh b/source/blender/draw/intern/draw_manager.hh index 5063de740e3..953a2db429b 100644 --- a/source/blender/draw/intern/draw_manager.hh +++ b/source/blender/draw/intern/draw_manager.hh @@ -109,6 +109,10 @@ class Manager { void submit(PassSimple &pass, View &view); void submit(PassMain &pass, View &view); void submit(PassSortable &pass, View &view); + /** + * Variant without any view. Must not contain any shader using `draw_view` create info. + */ + void submit(PassSimple &pass); /** * Submit a pass for drawing but read back all data buffers for inspection. |