Blender V4.3
draw_pass.hh File Reference
#include "BLI_listbase_wrapper.hh"
#include "BLI_vector.hh"
#include "BKE_image.hh"
#include "GPU_debug.hh"
#include "GPU_material.hh"
#include "DRW_gpu_wrapper.hh"
#include "draw_command.hh"
#include "draw_handle.hh"
#include "draw_manager.hh"
#include "draw_pass.hh"
#include "draw_shader_shared.hh"
#include "draw_state.hh"
#include "intern/gpu_codegen.hh"
#include <sstream>

Go to the source code of this file.

Classes

class  blender::draw::detail::SubPassVector< T, block_size >
 
class  blender::draw::detail::PassBase< DrawCommandBufType >
 
class  blender::draw::detail::Pass< DrawCommandBufType >
 
class  blender::draw::PassSortable
 

Namespaces

namespace  blender
 
namespace  blender::draw
 
namespace  blender::draw::command
 
namespace  blender::draw::detail
 

Detailed Description

Passes record draw commands. Commands are executed only when a pass is submitted for execution.

PassMain: Should be used on heavy load passes such as ones that may contain scene objects. Draw call submission is optimized for large number of draw calls. But has a significant overhead per Pass. Use many #PassSub along with a main Pass to reduce the overhead and allow groupings of commands.

Note
The draw call order inside a batch of multiple draw with the exact same state is not guaranteed and is not even deterministic. Use a #PassSimple or #PassSortable if ordering is needed. Custom vertex count and custom first vertex will effectively disable batching.

PassSimple: Does not have the overhead of #PassMain but does not have the culling and batching optimization. It should be used for passes that needs a few commands or that needs guaranteed draw call order.

Pass<T>::Sub: A lightweight Pass that lives inside a main Pass. It can only be created from #Pass.sub() and is auto managed. This mean it can be created, filled and thrown away. A #PassSub reference is valid until the next #Pass.init() of the parent pass. Commands recorded inside a #PassSub are inserted inside the parent Pass where the sub have been created during submission.

PassSortable: This is a sort of PassMain augmented with a per sub-pass sorting value. They can't directly contain draw command, everything needs to be inside sub-passes. Sub-passes are automatically sorted before submission.

Note
A pass can be recorded once and resubmitted any number of time. This can be a good optimization for passes that are always the same for each frame. The only thing to be aware of is the life time of external resources. If a pass contains draw-calls with non default #ResourceHandle (not 0) or a reference to any non static resources (#gpu::Batch, #PushConstant ref, #ResourceBind ref) it will have to be re-recorded if any of these reference becomes invalid.

Definition in file draw_pass.hh.