Blender V5.0
blender::draw::detail::PassBase< DrawCommandBufType > Class Template Reference

#include <draw_pass.hh>

Inherited by blender::draw::detail::Pass< command::DrawCommandBuf >, blender::draw::detail::Pass< command::DrawMultiBuf >, and blender::draw::detail::Pass< DrawCommandBufType >.

Public Member Functions

 PassBase (const char *name, DrawCommandBufType &draw_command_buf, SubPassVector< PassBase< DrawCommandBufType > > &sub_passes, gpu::Shader *shader=nullptr)
void init ()
template<class U>
void bind_resources (U &resources)
State Implementation
void state_set (DRWState state, int clip_plane_count=0)
void state_stencil (uint8_t write_mask, uint8_t reference, uint8_t compare_mask)
void shader_set (gpu::Shader *shader)
void framebuffer_set (gpu::FrameBuffer **framebuffer)
void subpass_transition (GPUAttachmentState depth_attachment, Span< GPUAttachmentState > color_attachments)
void material_set (Manager &manager, GPUMaterial *material, bool deferred_texture_loading=false)
Clear Implementation
void clear_color (float4 color)
void clear_depth (float depth)
void clear_stencil (uint8_t stencil)
void clear_depth_stencil (float depth, uint8_t stencil)
void clear_color_depth_stencil (float4 color, float depth, uint8_t stencil)
Draw calls
void draw (gpu::Batch *batch, uint instance_len=-1, uint vertex_len=-1, uint vertex_first=-1, ResourceIndexRange res_index={}, uint custom_id=0)
void draw (gpu::Batch *batch, ResourceIndexRange res_index, uint custom_id=0)
void draw_procedural (GPUPrimType primitive, uint instance_len, uint vertex_len, uint vertex_first=-1, ResourceIndexRange res_index={}, uint custom_id=0)
void draw_expand (gpu::Batch *batch, GPUPrimType primitive_type, uint primitive_len, uint instance_len, uint vertex_len, uint vertex_first, ResourceIndexRange res_index={}, uint custom_id=0)
void draw_expand (gpu::Batch *batch, GPUPrimType primitive_type, uint primitive_len, uint instance_len, ResourceIndexRange res_index={}, uint custom_id=0)
Indirect draw calls
void draw_indirect (gpu::Batch *batch, StorageBuffer< DrawCommand, true > &indirect_buffer, ResourceIndex res_index={0})
void draw_procedural_indirect (GPUPrimType primitive, StorageBuffer< DrawCommand, true > &indirect_buffer, ResourceIndex res_index={0})
Compute Dispatch Implementation
void dispatch (int group_len)
void dispatch (int2 group_len)
void dispatch (int3 group_len)
void dispatch (int3 *group_len)
void dispatch (StorageBuffer< DispatchCommand > &indirect_buffer)
Barrier Implementation
void barrier (GPUBarrier type)
Push Constant Implementation
void push_constant (const char *name, const float &data)
void push_constant (const char *name, const float2 &data)
void push_constant (const char *name, const float3 &data)
void push_constant (const char *name, const float4 &data)
void push_constant (const char *name, const int &data)
void push_constant (const char *name, const int2 &data)
void push_constant (const char *name, const int3 &data)
void push_constant (const char *name, const int4 &data)
void push_constant (const char *name, const bool &data)
void push_constant (const char *name, const float4x4 &data)
void push_constant (const char *name, const float *data, int array_len=1)
void push_constant (const char *name, const float2 *data, int array_len=1)
void push_constant (const char *name, const float3 *data, int array_len=1)
void push_constant (const char *name, const float4 *data, int array_len=1)
void push_constant (const char *name, const int *data, int array_len=1)
void push_constant (const char *name, const int2 *data, int array_len=1)
void push_constant (const char *name, const int3 *data, int array_len=1)
void push_constant (const char *name, const int4 *data, int array_len=1)
void push_constant (const char *name, const float4x4 *data)

Public Attributes

const char * debug_name
bool use_custom_ids

Protected Member Functions

bool has_generated_commands () const

Protected Attributes

Vector< command::Header, 0 > headers_
Vector< command::Undetermined, 0 > commands_
DrawCommandBufType & draw_commands_buf_
SubPassVector< PassBase< DrawCommandBufType > > & sub_passes_
gpu::Shadershader_
uint64_t manager_fingerprint_ = 0
uint64_t view_fingerprint_ = 0
bool is_empty_ = true

Friends

std::ostream & operator<< (std::ostream &stream, const PassBase &pass)

PassBase Implementation

bool is_empty () const
PassBase< DrawCommandBufType > & sub (const char *name)
void clear_multi (Span< float4 > colors)
std::string serialize (std::string line_prefix="") const
void clear (GPUFrameBufferBits planes, float4 color, float depth, uint8_t stencil)
gpu::Batch * procedural_batch_get (GPUPrimType primitive)
command::Undeterminedcreate_command (command::Type type)
void warm_shader_specialization (command::RecordingState &state) const
void submit (command::RecordingState &state) const

Resource bind Implementation

void bind_image (const char *name, gpu::Texture *image)
void bind_image (const char *name, gpu::Texture **image)
void bind_image (int slot, gpu::Texture *image)
void bind_image (int slot, gpu::Texture **image)
void bind_texture (const char *name, gpu::Texture *texture, GPUSamplerState state=sampler_auto)
void bind_texture (const char *name, gpu::Texture **texture, GPUSamplerState state=sampler_auto)
void bind_texture (const char *name, gpu::VertBuf *buffer)
void bind_texture (const char *name, gpu::VertBuf **buffer)
void bind_texture (const char *name, gpu::VertBufPtr &buffer)
void bind_texture (int slot, gpu::Texture *texture, GPUSamplerState state=sampler_auto)
void bind_texture (int slot, gpu::Texture **texture, GPUSamplerState state=sampler_auto)
void bind_texture (int slot, gpu::VertBuf *buffer)
void bind_texture (int slot, gpu::VertBuf **buffer)
void bind_texture (int slot, gpu::VertBufPtr &buffer)
void bind_ssbo (const char *name, gpu::StorageBuf *buffer)
void bind_ssbo (const char *name, gpu::StorageBuf **buffer)
void bind_ssbo (int slot, gpu::StorageBuf *buffer)
void bind_ssbo (int slot, gpu::StorageBuf **buffer)
void bind_ssbo (const char *name, gpu::UniformBuf *buffer)
void bind_ssbo (const char *name, gpu::UniformBuf **buffer)
void bind_ssbo (int slot, gpu::UniformBuf *buffer)
void bind_ssbo (int slot, gpu::UniformBuf **buffer)
void bind_ssbo (const char *name, gpu::VertBuf *buffer)
void bind_ssbo (const char *name, gpu::VertBuf **buffer)
void bind_ssbo (const char *name, gpu::VertBufPtr &buffer)
void bind_ssbo (int slot, gpu::VertBuf *buffer)
void bind_ssbo (int slot, gpu::VertBuf **buffer)
void bind_ssbo (int slot, gpu::VertBufPtr &buffer)
void bind_ssbo (const char *name, gpu::IndexBuf *buffer)
void bind_ssbo (const char *name, gpu::IndexBuf **buffer)
void bind_ssbo (int slot, gpu::IndexBuf *buffer)
void bind_ssbo (int slot, gpu::IndexBuf **buffer)
void bind_ubo (const char *name, gpu::UniformBuf *buffer)
void bind_ubo (const char *name, gpu::UniformBuf **buffer)
void bind_ubo (int slot, gpu::UniformBuf *buffer)
void bind_ubo (int slot, gpu::UniformBuf **buffer)
void specialize_constant (gpu::Shader *shader, const char *name, const float &data)
void specialize_constant (gpu::Shader *shader, const char *name, const int &data)
void specialize_constant (gpu::Shader *shader, const char *name, const uint &data)
void specialize_constant (gpu::Shader *shader, const char *name, const bool &data)
void specialize_constant (gpu::Shader *shader, const char *name, const float *data)
void specialize_constant (gpu::Shader *shader, const char *name, const int *data)
void specialize_constant (gpu::Shader *shader, const char *name, const uint *data)
void specialize_constant (gpu::Shader *shader, const char *name, const bool *data)
int push_constant_offset (const char *name)

Detailed Description

template<typename DrawCommandBufType>
class blender::draw::detail::PassBase< DrawCommandBufType >

Public API of a draw pass.

Template Parameters
DrawCommandBufTypeType of command buffer used to create the draw calls.

Definition at line 128 of file draw_pass.hh.

Constructor & Destructor Documentation

◆ PassBase()

template<typename DrawCommandBufType>
blender::draw::detail::PassBase< DrawCommandBufType >::PassBase ( const char * name,
DrawCommandBufType & draw_command_buf,
SubPassVector< PassBase< DrawCommandBufType > > & sub_passes,
gpu::Shader * shader = nullptr )
inline

Member Function Documentation

◆ barrier()

template<class T>
void blender::draw::detail::PassBase< T >::barrier ( GPUBarrier type)
inline

Record a barrier call to synchronize arbitrary load/store operation between draw calls.

Definition at line 1078 of file draw_pass.hh.

References blender::draw::command::Barrier, barrier(), and create_command().

Referenced by barrier(), blender::eevee::SphereProbeModule::begin_sync(), blender::eevee::DeferredLayer::end_sync(), blender::eevee::DeferredProbePipeline::end_sync(), blender::eevee::PlanarProbePipeline::end_sync(), blender::eevee::ShadowModule::end_sync(), blender::eevee::SubsurfaceModule::end_sync(), blender::draw::CurvesModule::evaluate_curve_attribute(), blender::draw::CurvesModule::evaluate_curve_length_intercept(), blender::eevee::VelocityModule::geometry_steps_fill(), blender::eevee::Precompute::Precompute(), blender::eevee::HiZBuffer::sync(), blender::eevee::IrradianceBake::sync(), blender::eevee::MotionBlurModule::sync(), blender::eevee::RayTraceModule::sync(), blender::eevee::VolumeLayer::sync(), blender::draw::test_draw_curves_interpolate_attributes(), blender::draw::test_draw_curves_interpolate_position(), blender::draw::test_draw_curves_lib(), blender::draw::test_draw_curves_topology(), blender::draw::test_draw_pass_all_commands(), blender::draw::test_eevee_shadow_finalize(), blender::draw::test_eevee_shadow_free(), blender::draw::test_eevee_shadow_shift(), blender::draw::test_eevee_shadow_shift_clear(), blender::draw::test_eevee_shadow_tag_update(), blender::draw::test_eevee_shadow_tilemap_amend(), blender::draw::test_eevee_surfel_list(), blender::draw::TestAlloc::TestAlloc(), blender::draw::TestDefrag::TestDefrag(), and blender::eevee::Film::write_viewport_compositor_passes().

◆ bind_image() [1/4]

template<class T>
void blender::draw::detail::PassBase< T >::bind_image ( const char * name,
gpu::Texture ** image )
inline

Definition at line 1405 of file draw_pass.hh.

References bind_image(), BLI_assert, GPU_shader_get_sampler_binding(), name, and shader_.

◆ bind_image() [2/4]

template<class T>
void blender::draw::detail::PassBase< T >::bind_image ( const char * name,
gpu::Texture * image )
inline

◆ bind_image() [3/4]

template<class T>
void blender::draw::detail::PassBase< T >::bind_image ( int slot,
gpu::Texture ** image )
inline

◆ bind_image() [4/4]

template<class T>
void blender::draw::detail::PassBase< T >::bind_image ( int slot,
gpu::Texture * image )
inline

◆ bind_resources()

◆ bind_ssbo() [1/18]

template<class T>
void blender::draw::detail::PassBase< T >::bind_ssbo ( const char * name,
gpu::IndexBuf ** buffer )
inline

Definition at line 1247 of file draw_pass.hh.

References bind_ssbo(), BLI_assert, GPU_shader_get_ssbo_binding(), name, and shader_.

◆ bind_ssbo() [2/18]

template<class T>
void blender::draw::detail::PassBase< T >::bind_ssbo ( const char * name,
gpu::IndexBuf * buffer )
inline

Definition at line 1241 of file draw_pass.hh.

References bind_ssbo(), BLI_assert, GPU_shader_get_ssbo_binding(), name, and shader_.

◆ bind_ssbo() [3/18]

template<class T>
void blender::draw::detail::PassBase< T >::bind_ssbo ( const char * name,
gpu::StorageBuf ** buffer )
inline

Definition at line 1384 of file draw_pass.hh.

References bind_ssbo(), BLI_assert, GPU_shader_get_ssbo_binding(), name, and shader_.

◆ bind_ssbo() [4/18]

template<class T>
void blender::draw::detail::PassBase< T >::bind_ssbo ( const char * name,
gpu::StorageBuf * buffer )
inline

Definition at line 1205 of file draw_pass.hh.

References bind_ssbo(), BLI_assert, GPU_shader_get_ssbo_binding(), name, and shader_.

Referenced by blender::eevee::ShadowModule::begin_sync(), blender::eevee::SphereProbeModule::begin_sync(), bind_ssbo(), bind_ssbo(), bind_ssbo(), bind_ssbo(), bind_ssbo(), bind_ssbo(), bind_ssbo(), bind_ssbo(), bind_ssbo(), bind_ssbo(), bind_ssbo(), bind_ssbo(), bind_ssbo(), bind_ssbo(), bind_ssbo(), bind_ssbo(), bind_ssbo(), bind_ssbo(), blender::draw::overlay::ShapeInstanceBuf< ExtraInstanceData >::end_sync(), blender::draw::overlay::ShapeInstanceBuf< ExtraInstanceData >::end_sync(), blender::draw::overlay::VertexPrimitiveBuf::end_sync(), blender::eevee::DeferredLayer::end_sync(), blender::eevee::ShadowModule::end_sync(), blender::eevee::SubsurfaceModule::end_sync(), blender::draw::CurvesModule::evaluate_curve_attribute(), blender::draw::CurvesModule::evaluate_curve_length_intercept(), blender::draw::CurvesModule::evaluate_topology_indirection(), blender::eevee::VelocityModule::geometry_steps_fill(), blender::workbench::MeshPass::init_pass(), blender::draw::select::SelectBuf::select_bind(), blender::draw::select::SelectMap::select_bind(), blender::draw::select::SelectMap::select_bind(), blender::draw::select::SelectMap::select_bind(), blender::eevee::IrradianceBake::surfels_create(), blender::eevee::HiZBuffer::sync(), blender::eevee::IrradianceBake::sync(), blender::eevee::MotionBlurModule::sync(), blender::eevee::RayTraceModule::sync(), blender::eevee::ShadowPipeline::sync(), blender::eevee::WorldPipeline::sync(), blender::draw::test_draw_curves_interpolate_attributes(), blender::draw::test_draw_curves_interpolate_position(), blender::draw::test_draw_curves_lib(), blender::draw::test_draw_curves_topology(), blender::draw::test_draw_pass_all_commands(), blender::draw::test_eevee_shadow_finalize(), blender::draw::test_eevee_shadow_free(), blender::draw::test_eevee_shadow_page_mask_ex(), blender::draw::test_eevee_shadow_shift(), blender::draw::test_eevee_shadow_shift_clear(), blender::draw::test_eevee_shadow_tag_update(), blender::draw::test_eevee_shadow_tilemap_amend(), blender::draw::test_eevee_surfel_list(), blender::draw::TestAlloc::TestAlloc(), and blender::draw::TestDefrag::TestDefrag().

◆ bind_ssbo() [5/18]

template<class T>
void blender::draw::detail::PassBase< T >::bind_ssbo ( const char * name,
gpu::UniformBuf ** buffer )
inline

Definition at line 1217 of file draw_pass.hh.

References bind_ssbo(), BLI_assert, GPU_shader_get_ssbo_binding(), name, and shader_.

◆ bind_ssbo() [6/18]

template<class T>
void blender::draw::detail::PassBase< T >::bind_ssbo ( const char * name,
gpu::UniformBuf * buffer )
inline

Definition at line 1211 of file draw_pass.hh.

References bind_ssbo(), BLI_assert, GPU_shader_get_ssbo_binding(), name, and shader_.

◆ bind_ssbo() [7/18]

template<class T>
void blender::draw::detail::PassBase< T >::bind_ssbo ( const char * name,
gpu::VertBuf ** buffer )
inline

Definition at line 1229 of file draw_pass.hh.

References bind_ssbo(), BLI_assert, GPU_shader_get_ssbo_binding(), name, and shader_.

◆ bind_ssbo() [8/18]

template<class T>
void blender::draw::detail::PassBase< T >::bind_ssbo ( const char * name,
gpu::VertBuf * buffer )
inline

Definition at line 1223 of file draw_pass.hh.

References bind_ssbo(), BLI_assert, GPU_shader_get_ssbo_binding(), name, and shader_.

◆ bind_ssbo() [9/18]

template<class T>
void blender::draw::detail::PassBase< T >::bind_ssbo ( const char * name,
gpu::VertBufPtr & buffer )
inline

Definition at line 1235 of file draw_pass.hh.

References bind_ssbo(), BLI_assert, GPU_shader_get_ssbo_binding(), name, and shader_.

◆ bind_ssbo() [10/18]

template<class T>
void blender::draw::detail::PassBase< T >::bind_ssbo ( int slot,
gpu::IndexBuf ** buffer )
inline

◆ bind_ssbo() [11/18]

◆ bind_ssbo() [12/18]

template<class T>
void blender::draw::detail::PassBase< T >::bind_ssbo ( int slot,
gpu::StorageBuf ** buffer )
inline

◆ bind_ssbo() [13/18]

template<class T>
void blender::draw::detail::PassBase< T >::bind_ssbo ( int slot,
gpu::StorageBuf * buffer )
inline

◆ bind_ssbo() [14/18]

◆ bind_ssbo() [15/18]

◆ bind_ssbo() [16/18]

template<class T>
void blender::draw::detail::PassBase< T >::bind_ssbo ( int slot,
gpu::VertBuf ** buffer )
inline

◆ bind_ssbo() [17/18]

◆ bind_ssbo() [18/18]

◆ bind_texture() [1/10]

template<class T>
void blender::draw::detail::PassBase< T >::bind_texture ( const char * name,
gpu::Texture ** texture,
GPUSamplerState state = sampler_auto )
inline

◆ bind_texture() [2/10]

template<class T>
void blender::draw::detail::PassBase< T >::bind_texture ( const char * name,
gpu::Texture * texture,
GPUSamplerState state = sampler_auto )
inline

Definition at line 1260 of file draw_pass.hh.

References bind_texture(), BLI_assert, GPU_shader_get_sampler_binding(), name, shader_, state, and texture().

Referenced by blender::draw::gpencil::Instance::begin_sync(), blender::draw::overlay::AntiAliasing::begin_sync(), blender::draw::overlay::Lattices::begin_sync(), blender::draw::overlay::Meshes::begin_sync(), blender::draw::overlay::XrayFade::begin_sync(), blender::eevee::DeferredProbePipeline::begin_sync(), blender::eevee::ShadowModule::begin_sync(), blender::eevee::SphereProbeModule::begin_sync(), bind_texture(), bind_texture(), bind_texture(), bind_texture(), bind_texture(), bind_texture(), bind_texture(), bind_texture(), bind_texture(), bind_texture(), blender::draw::overlay::GreasePencil::draw_grease_pencil(), blender::eevee::DeferredLayer::end_sync(), blender::eevee::DeferredProbePipeline::end_sync(), blender::eevee::PlanarProbePipeline::end_sync(), blender::eevee::SubsurfaceModule::end_sync(), blender::workbench::MeshPass::get_subpass(), blender::workbench::MeshPass::init_pass(), material_set(), blender::draw::overlay::Fluids::object_sync(), blender::workbench::VolumePass::object_sync_modifier(), blender::workbench::VolumePass::object_sync_volume(), blender::workbench::CavityEffect::setup_resolve_pass(), blender::eevee::ForwardPipeline::sync(), blender::eevee::HiZBuffer::sync(), blender::eevee::IrradianceBake::sync(), blender::eevee::MotionBlurModule::sync(), blender::eevee::RayTraceModule::sync(), blender::eevee::ShadowPipeline::sync(), blender::eevee::VolumeLayer::sync(), blender::eevee::WorldPipeline::sync(), blender::draw::test_draw_curves_lib(), blender::draw::test_draw_pass_all_commands(), blender::draw::test_draw_visibility(), and blender::eevee::Film::write_viewport_compositor_passes().

◆ bind_texture() [3/10]

template<class T>
void blender::draw::detail::PassBase< T >::bind_texture ( const char * name,
gpu::VertBuf ** buffer )
inline

Definition at line 1274 of file draw_pass.hh.

References bind_texture(), BLI_assert, GPU_shader_get_sampler_binding(), name, and shader_.

◆ bind_texture() [4/10]

template<class T>
void blender::draw::detail::PassBase< T >::bind_texture ( const char * name,
gpu::VertBuf * buffer )
inline

Definition at line 1268 of file draw_pass.hh.

References bind_texture(), BLI_assert, GPU_shader_get_sampler_binding(), name, and shader_.

◆ bind_texture() [5/10]

template<class T>
void blender::draw::detail::PassBase< T >::bind_texture ( const char * name,
gpu::VertBufPtr & buffer )
inline

Definition at line 1280 of file draw_pass.hh.

References bind_texture(), BLI_assert, GPU_shader_get_sampler_binding(), name, and shader_.

◆ bind_texture() [6/10]

template<class T>
void blender::draw::detail::PassBase< T >::bind_texture ( int slot,
gpu::Texture ** texture,
GPUSamplerState state = sampler_auto )
inline

◆ bind_texture() [7/10]

template<class T>
void blender::draw::detail::PassBase< T >::bind_texture ( int slot,
gpu::Texture * texture,
GPUSamplerState state = sampler_auto )
inline

◆ bind_texture() [8/10]

template<class T>
void blender::draw::detail::PassBase< T >::bind_texture ( int slot,
gpu::VertBuf ** buffer )
inline

◆ bind_texture() [9/10]

template<class T>
void blender::draw::detail::PassBase< T >::bind_texture ( int slot,
gpu::VertBuf * buffer )
inline

◆ bind_texture() [10/10]

template<class T>
void blender::draw::detail::PassBase< T >::bind_texture ( int slot,
gpu::VertBufPtr & buffer )
inline

◆ bind_ubo() [1/4]

template<class T>
void blender::draw::detail::PassBase< T >::bind_ubo ( const char * name,
gpu::UniformBuf ** buffer )
inline

Definition at line 1390 of file draw_pass.hh.

References bind_ubo(), BLI_assert, GPU_shader_get_ubo_binding(), name, and shader_.

◆ bind_ubo() [2/4]

◆ bind_ubo() [3/4]

template<class T>
void blender::draw::detail::PassBase< T >::bind_ubo ( int slot,
gpu::UniformBuf ** buffer )
inline

◆ bind_ubo() [4/4]

template<class T>
void blender::draw::detail::PassBase< T >::bind_ubo ( int slot,
gpu::UniformBuf * buffer )
inline

◆ clear()

template<class T>
void blender::draw::detail::PassBase< T >::clear ( GPUFrameBufferBits planes,
float4 color,
float depth,
uint8_t stencil )
inlineprotected

Definition at line 658 of file draw_pass.hh.

References blender::draw::command::Clear, clear(), and create_command().

Referenced by clear().

◆ clear_color()

template<class T>
void blender::draw::detail::PassBase< T >::clear_color ( float4 color)
inline

Clear the current frame-buffer.

Definition at line 1046 of file draw_pass.hh.

References clear(), clear_color(), and GPU_COLOR_BIT.

Referenced by clear_color().

◆ clear_color_depth_stencil()

template<class T>
void blender::draw::detail::PassBase< T >::clear_color_depth_stencil ( float4 color,
float depth,
uint8_t stencil )
inline

◆ clear_depth()

template<class T>
void blender::draw::detail::PassBase< T >::clear_depth ( float depth)
inline

Definition at line 1051 of file draw_pass.hh.

References clear(), clear_depth(), and GPU_DEPTH_BIT.

Referenced by clear_depth().

◆ clear_depth_stencil()

template<class T>
void blender::draw::detail::PassBase< T >::clear_depth_stencil ( float depth,
uint8_t stencil )
inline

Definition at line 1061 of file draw_pass.hh.

References clear(), clear_depth_stencil(), GPU_DEPTH_BIT, and GPU_STENCIL_BIT.

Referenced by clear_depth_stencil().

◆ clear_multi()

template<class T>
void blender::draw::detail::PassBase< T >::clear_multi ( Span< float4 > colors)
inline

Clear each color attachment with different values. Span needs to be appropriately sized. IMPORTANT: The source is dereference on pass submission.

Definition at line 666 of file draw_pass.hh.

References clear_multi(), blender::draw::command::ClearMulti, create_command(), blender::Span< T >::data(), and blender::Span< T >::size().

Referenced by clear_multi().

◆ clear_stencil()

template<class T>
void blender::draw::detail::PassBase< T >::clear_stencil ( uint8_t stencil)
inline

Definition at line 1056 of file draw_pass.hh.

References clear(), clear_stencil(), and GPU_STENCIL_BIT.

Referenced by clear_stencil(), and blender::eevee::VolumeLayer::sync().

◆ create_command()

template<class T>
command::Undetermined & blender::draw::detail::PassBase< T >::create_command ( command::Type type)
inlineprotected

◆ dispatch() [1/5]

template<class T>
void blender::draw::detail::PassBase< T >::dispatch ( int group_len)
inline

◆ dispatch() [2/5]

template<class T>
void blender::draw::detail::PassBase< T >::dispatch ( int2 group_len)
inline

◆ dispatch() [3/5]

template<class T>
void blender::draw::detail::PassBase< T >::dispatch ( int3 * group_len)
inline

◆ dispatch() [4/5]

template<class T>
void blender::draw::detail::PassBase< T >::dispatch ( int3 group_len)
inline

◆ dispatch() [5/5]

template<class T>
void blender::draw::detail::PassBase< T >::dispatch ( StorageBuffer< DispatchCommand > & indirect_buffer)
inline

◆ draw() [1/2]

template<class T>
void blender::draw::detail::PassBase< T >::draw ( gpu::Batch * batch,
ResourceIndexRange res_index,
uint custom_id = 0 )
inline

Shorter version for the common case.

Note
Implemented in derived class. Not a virtual function to avoid indirection.

Definition at line 919 of file draw_pass.hh.

References batch, and draw().

◆ draw() [2/2]

◆ draw_expand() [1/2]

template<class T>
void blender::draw::detail::PassBase< T >::draw_expand ( gpu::Batch * batch,
GPUPrimType primitive_type,
uint primitive_len,
uint instance_len,
ResourceIndexRange res_index = {},
uint custom_id = 0 )
inline

Shorter version for the common case.

Note
Implemented in derived class. Not a virtual function to avoid indirection.

Definition at line 952 of file draw_pass.hh.

References batch, and draw_expand().

◆ draw_expand() [2/2]

template<class T>
void blender::draw::detail::PassBase< T >::draw_expand ( gpu::Batch * batch,
GPUPrimType primitive_type,
uint primitive_len,
uint instance_len,
uint vertex_len,
uint vertex_first,
ResourceIndexRange res_index = {},
uint custom_id = 0 )
inline

Record a regular draw call but replaces each original primitive by a set of the given primitive. Geometry attributes are still sourced from a gpu::Batch, however, the attributes indexing needs to be done manually inside the shader.

Note
primitive_type and primitive_len must be baked into the shader and without using specialization constant!
A primitive_len count of 0 will discard the draw call. It will not be recorded.
vertex_len and vertex_first are relative to the original primitive list.
Only works for GPU_PRIM_POINTS, GPU_PRIM_LINES, GPU_PRIM_TRIS, GPU_PRIM_LINES_ADJ and GPU_PRIM_TRIS_ADJ original primitive types.

Definition at line 925 of file draw_pass.hh.

References batch, BLI_assert, commands_, draw_commands_buf_, draw_expand(), headers_, is_empty_, and shader_.

Referenced by blender::draw::overlay::Cursor::begin_sync(), draw_expand(), draw_expand(), blender::draw::overlay::ShapeInstanceBuf< ExtraInstanceData >::end_sync(), blender::draw::overlay::Prepass::object_sync(), and blender::workbench::ShadowPass::object_sync().

◆ draw_indirect()

template<class T>
void blender::draw::detail::PassBase< T >::draw_indirect ( gpu::Batch * batch,
StorageBuffer< DrawCommand, true > & indirect_buffer,
ResourceIndex res_index = {0} )
inline

Indirect variants.

Note
If needed, the resource id need to also be set accordingly in the DrawCommand.

Definition at line 986 of file draw_pass.hh.

References batch, BLI_assert, create_command(), draw_indirect(), blender::draw::command::DrawIndirect, and shader_.

Referenced by draw_indirect(), and draw_procedural_indirect().

◆ draw_procedural()

◆ draw_procedural_indirect()

template<class T>
void blender::draw::detail::PassBase< T >::draw_procedural_indirect ( GPUPrimType primitive,
StorageBuffer< DrawCommand, true > & indirect_buffer,
ResourceIndex res_index = {0} )
inline

◆ framebuffer_set()

template<class T>
void blender::draw::detail::PassBase< T >::framebuffer_set ( gpu::FrameBuffer ** framebuffer)
inline

Bind a framebuffer. This is equivalent to a deferred GPU_framebuffer_bind() call.

Note
Changes the global GPU state (outside of DRW).
Capture reference to the framebuffer so it can be initialized later.

Definition at line 1112 of file draw_pass.hh.

References create_command(), framebuffer_set(), and blender::draw::command::FramebufferBind.

Referenced by blender::draw::overlay::AntiAliasing::begin_sync(), blender::draw::overlay::XrayFade::begin_sync(), blender::eevee::ShadowModule::begin_sync(), blender::eevee::ShadowModule::end_sync(), framebuffer_set(), blender::draw::test_draw_curves_lib(), and blender::draw::test_draw_pass_all_commands().

◆ has_generated_commands()

template<typename DrawCommandBufType>
bool blender::draw::detail::PassBase< DrawCommandBufType >::has_generated_commands ( ) const
inlineprotected

Definition at line 488 of file draw_pass.hh.

References manager_fingerprint_.

Referenced by create_command(), and blender::draw::Manager::submit().

◆ init()

template<typename DrawCommandBufType>
void blender::draw::detail::PassBase< DrawCommandBufType >::init ( )

Reset the pass command pool.

Note
Implemented in derived class. Not a virtual function to avoid indirection. Here only for API readability listing.

References batch, draw(), name, PassBase(), and state.

◆ is_empty()

◆ material_set()

◆ procedural_batch_get()

◆ push_constant() [1/19]

template<class T>
void blender::draw::detail::PassBase< T >::push_constant ( const char * name,
const bool & data )
inline

◆ push_constant() [2/19]

template<class T>
void blender::draw::detail::PassBase< T >::push_constant ( const char * name,
const float & data )
inline

Update a shader constant.

Reference versions are to be used when the resource might change between the time it is referenced and the time it is dereferenced for drawing.

IMPORTANT: Will keep a reference to the data and dereference it upon drawing. Make sure data still alive until pass submission.

Note
bool reference version is expected to take bool32_t reference which is aliased to int.

Definition at line 1443 of file draw_pass.hh.

References create_command(), data, name, push_constant(), push_constant_offset(), and blender::draw::command::PushConstant.

Referenced by blender::draw::gpencil::Instance::antialiasing_accumulate(), blender::draw::gpencil::Instance::begin_sync(), blender::draw::overlay::AntiAliasing::begin_sync(), blender::draw::overlay::Cameras::begin_sync(), blender::draw::overlay::Cursor::begin_sync(), blender::draw::overlay::Empties::begin_sync(), blender::draw::overlay::Fade::begin_sync(), blender::draw::overlay::Meshes::begin_sync(), blender::draw::overlay::XrayFade::begin_sync(), blender::eevee::ShadowModule::begin_sync(), blender::eevee::SphereProbeModule::begin_sync(), blender::draw::overlay::GreasePencil::draw_grease_pencil(), blender::draw::edit_select::Instance::edit_mesh_sync(), blender::draw::overlay::VertexPrimitiveBuf::end_sync(), blender::eevee::DeferredLayer::end_sync(), blender::eevee::ShadowModule::end_sync(), blender::draw::CurvesModule::evaluate_curve_attribute(), blender::draw::CurvesModule::evaluate_curve_length_intercept(), blender::draw::CurvesModule::evaluate_topology_indirection(), blender::eevee::VelocityModule::geometry_steps_fill(), blender::workbench::MeshPass::get_subpass(), blender::draw::overlay::Fluids::object_sync(), blender::workbench::VolumePass::object_sync_modifier(), blender::workbench::VolumePass::object_sync_volume(), blender::eevee::VolumeLayer::occupancy_add(), blender::eevee::Precompute::Precompute(), push_constant(), push_constant(), push_constant(), push_constant(), push_constant(), push_constant(), push_constant(), push_constant(), push_constant(), push_constant(), push_constant(), push_constant(), push_constant(), push_constant(), push_constant(), push_constant(), push_constant(), push_constant(), push_constant(), blender::eevee::CapturePipeline::surface_material_add(), blender::eevee::IrradianceBake::surfels_create(), blender::eevee::HiZBuffer::sync(), blender::eevee::IrradianceBake::sync(), blender::eevee::WorldPipeline::sync(), blender::eevee::SyncModule::sync_pointcloud(), blender::draw::test_draw_curves_interpolate_attributes(), blender::draw::test_draw_curves_interpolate_position(), blender::draw::test_draw_curves_topology(), blender::draw::test_draw_pass_all_commands(), blender::draw::test_draw_pass_sub_ordering(), blender::draw::test_eevee_shadow_page_mask_ex(), and blender::eevee::Film::write_viewport_compositor_passes().

◆ push_constant() [3/19]

template<class T>
void blender::draw::detail::PassBase< T >::push_constant ( const char * name,
const float * data,
int array_len = 1 )
inline

◆ push_constant() [4/19]

template<class T>
void blender::draw::detail::PassBase< T >::push_constant ( const char * name,
const float2 & data )
inline

◆ push_constant() [5/19]

template<class T>
void blender::draw::detail::PassBase< T >::push_constant ( const char * name,
const float2 * data,
int array_len = 1 )
inline

◆ push_constant() [6/19]

template<class T>
void blender::draw::detail::PassBase< T >::push_constant ( const char * name,
const float3 & data )
inline

◆ push_constant() [7/19]

template<class T>
void blender::draw::detail::PassBase< T >::push_constant ( const char * name,
const float3 * data,
int array_len = 1 )
inline

◆ push_constant() [8/19]

template<class T>
void blender::draw::detail::PassBase< T >::push_constant ( const char * name,
const float4 & data )
inline

◆ push_constant() [9/19]

template<class T>
void blender::draw::detail::PassBase< T >::push_constant ( const char * name,
const float4 * data,
int array_len = 1 )
inline

◆ push_constant() [10/19]

◆ push_constant() [11/19]

template<class T>
void blender::draw::detail::PassBase< T >::push_constant ( const char * name,
const float4x4 * data )
inline

◆ push_constant() [12/19]

template<class T>
void blender::draw::detail::PassBase< T >::push_constant ( const char * name,
const int & data )
inline

◆ push_constant() [13/19]

template<class T>
void blender::draw::detail::PassBase< T >::push_constant ( const char * name,
const int * data,
int array_len = 1 )
inline

◆ push_constant() [14/19]

template<class T>
void blender::draw::detail::PassBase< T >::push_constant ( const char * name,
const int2 & data )
inline

◆ push_constant() [15/19]

template<class T>
void blender::draw::detail::PassBase< T >::push_constant ( const char * name,
const int2 * data,
int array_len = 1 )
inline

◆ push_constant() [16/19]

template<class T>
void blender::draw::detail::PassBase< T >::push_constant ( const char * name,
const int3 & data )
inline

◆ push_constant() [17/19]

template<class T>
void blender::draw::detail::PassBase< T >::push_constant ( const char * name,
const int3 * data,
int array_len = 1 )
inline

◆ push_constant() [18/19]

template<class T>
void blender::draw::detail::PassBase< T >::push_constant ( const char * name,
const int4 & data )
inline

◆ push_constant() [19/19]

template<class T>
void blender::draw::detail::PassBase< T >::push_constant ( const char * name,
const int4 * data,
int array_len = 1 )
inline

◆ push_constant_offset()

◆ serialize()

◆ shader_set()

template<class T>
void blender::draw::detail::PassBase< T >::shader_set ( gpu::Shader * shader)
inline

Bind a shader. Any following bind() or push_constant() call will use its interface.

Definition at line 1106 of file draw_pass.hh.

References create_command(), shader_, shader_set(), and blender::draw::command::ShaderBind.

Referenced by blender::draw::gpencil::Instance::antialiasing_accumulate(), blender::draw::gpencil::Instance::begin_sync(), blender::draw::overlay::AntiAliasing::begin_sync(), blender::draw::overlay::Cameras::begin_sync(), blender::draw::overlay::Cursor::begin_sync(), blender::draw::overlay::Empties::begin_sync(), blender::draw::overlay::Lattices::begin_sync(), blender::draw::overlay::Meshes::begin_sync(), blender::draw::overlay::MotionPath::begin_sync(), blender::draw::overlay::XrayFade::begin_sync(), blender::eevee::ShadowModule::begin_sync(), blender::eevee::SphereProbeModule::begin_sync(), blender::draw::overlay::Cameras::end_sync(), blender::draw::overlay::Empties::end_sync(), blender::draw::overlay::LightProbes::end_sync(), blender::draw::overlay::Lights::end_sync(), blender::draw::overlay::Relations::end_sync(), blender::eevee::DeferredLayer::end_sync(), blender::eevee::DeferredProbePipeline::end_sync(), blender::eevee::PlanarProbePipeline::end_sync(), blender::eevee::ShadowModule::end_sync(), blender::eevee::SubsurfaceModule::end_sync(), blender::draw::CurvesModule::evaluate_curve_attribute(), blender::draw::CurvesModule::evaluate_curve_length_intercept(), blender::draw::CurvesModule::evaluate_topology_indirection(), blender::eevee::VelocityModule::geometry_steps_fill(), material_set(), blender::workbench::VolumePass::object_sync_modifier(), blender::workbench::VolumePass::object_sync_volume(), blender::eevee::Precompute::Precompute(), shader_set(), blender::eevee::CapturePipeline::surface_material_add(), blender::eevee::IrradianceBake::surfels_create(), blender::eevee::HiZBuffer::sync(), blender::eevee::IrradianceBake::sync(), blender::eevee::MotionBlurModule::sync(), blender::eevee::RayTraceModule::sync(), blender::eevee::ShadowPipeline::sync(), blender::workbench::ShadowPass::sync(), blender::draw::test_draw_curves_interpolate_attributes(), blender::draw::test_draw_curves_interpolate_position(), blender::draw::test_draw_curves_lib(), blender::draw::test_draw_curves_topology(), blender::draw::test_draw_pass_all_commands(), blender::draw::test_draw_pass_multi_draw(), blender::draw::test_draw_pass_simple_draw(), blender::draw::test_draw_pass_sub_ordering(), blender::draw::test_draw_resource_id_gen(), blender::draw::test_draw_submit_only(), blender::draw::test_draw_visibility(), blender::draw::test_eevee_shadow_finalize(), blender::draw::test_eevee_shadow_free(), blender::draw::test_eevee_shadow_page_mask_ex(), blender::draw::test_eevee_shadow_shift(), blender::draw::test_eevee_shadow_shift_clear(), blender::draw::test_eevee_shadow_tag_update(), blender::draw::test_eevee_shadow_tilemap_amend(), blender::draw::test_eevee_surfel_list(), blender::draw::TestAlloc::TestAlloc(), blender::draw::TestDefrag::TestDefrag(), and blender::eevee::Film::write_viewport_compositor_passes().

◆ specialize_constant() [1/8]

template<class T>
void blender::draw::detail::PassBase< T >::specialize_constant ( gpu::Shader * shader,
const char * name,
const bool & data )
inline

◆ specialize_constant() [2/8]

template<class T>
void blender::draw::detail::PassBase< T >::specialize_constant ( gpu::Shader * shader,
const char * name,
const bool * data )
inline

◆ specialize_constant() [3/8]

template<class T>
void blender::draw::detail::PassBase< T >::specialize_constant ( gpu::Shader * shader,
const char * name,
const float & data )
inline

Update a shader specialization constant.

IMPORTANT: Non-specialized constants can have undefined values. Specialize every constant before binding a shader.

Reference versions are to be used when the resource might change between the time it is referenced and the time it is dereferenced for drawing.

IMPORTANT: Will keep a reference to the data and dereference it upon drawing. Make sure data still alive until pass submission.

Definition at line 1585 of file draw_pass.hh.

References create_command(), GPU_shader_get_constant(), specialize_constant(), and blender::draw::command::SpecializeConstant.

Referenced by blender::eevee::SphereProbeModule::begin_sync(), blender::eevee::DeferredLayer::end_sync(), blender::draw::CurvesModule::evaluate_curve_attribute(), specialize_constant(), specialize_constant(), specialize_constant(), specialize_constant(), specialize_constant(), specialize_constant(), specialize_constant(), specialize_constant(), blender::eevee::HiZBuffer::sync(), blender::eevee::RayTraceModule::sync(), blender::draw::test_draw_curves_interpolate_attributes(), and blender::draw::test_draw_curves_interpolate_position().

◆ specialize_constant() [4/8]

template<class T>
void blender::draw::detail::PassBase< T >::specialize_constant ( gpu::Shader * shader,
const char * name,
const float * data )
inline

◆ specialize_constant() [5/8]

template<class T>
void blender::draw::detail::PassBase< T >::specialize_constant ( gpu::Shader * shader,
const char * name,
const int & data )
inline

◆ specialize_constant() [6/8]

template<class T>
void blender::draw::detail::PassBase< T >::specialize_constant ( gpu::Shader * shader,
const char * name,
const int * data )
inline

◆ specialize_constant() [7/8]

template<class T>
void blender::draw::detail::PassBase< T >::specialize_constant ( gpu::Shader * shader,
const char * name,
const uint & data )
inline

◆ specialize_constant() [8/8]

template<class T>
void blender::draw::detail::PassBase< T >::specialize_constant ( gpu::Shader * shader,
const char * name,
const uint * data )
inline

◆ state_set()

template<class T>
void blender::draw::detail::PassBase< T >::state_set ( DRWState state,
int clip_plane_count = 0 )
inline

Changes the fixed function pipeline state. Starts as DRW_STATE_NO_DRAW at the start of a Pass submission. SubPass inherit previous pass state.

IMPORTANT: This does not set the stencil mask/reference values. Add a call to state_stencil() to ensure correct behavior of stencil aware draws.

TODO(fclem): clip_plane_count should be part of shader state.

Note
This is for compatibility with the old clip plane API.

Definition at line 1089 of file draw_pass.hh.

References create_command(), DRW_STATE_CLIP_PLANES, DRW_STATE_PROGRAM_POINT_SIZE, state, state_set(), and blender::draw::command::StateSet.

Referenced by blender::draw::gpencil::Instance::antialiasing_accumulate(), blender::draw::gpencil::Instance::begin_sync(), blender::draw::overlay::AntiAliasing::begin_sync(), blender::draw::overlay::Cameras::begin_sync(), blender::draw::overlay::Cursor::begin_sync(), blender::draw::overlay::Empties::begin_sync(), blender::draw::overlay::Meshes::begin_sync(), blender::draw::overlay::MotionPath::begin_sync(), blender::draw::overlay::XrayFade::begin_sync(), blender::eevee::ShadowModule::begin_sync(), blender::image_engine::ScreenSpaceDrawingMode::begin_sync(), blender::draw::overlay::Axes::end_sync(), blender::draw::overlay::Cameras::end_sync(), blender::draw::overlay::Empties::end_sync(), blender::draw::overlay::LightProbes::end_sync(), blender::draw::overlay::Lights::end_sync(), blender::draw::overlay::Relations::end_sync(), blender::eevee::DeferredLayer::end_sync(), blender::eevee::DeferredProbePipeline::end_sync(), blender::eevee::PlanarProbePipeline::end_sync(), blender::eevee::ShadowModule::end_sync(), blender::eevee::SubsurfaceModule::end_sync(), blender::eevee::VelocityModule::geometry_steps_fill(), blender::workbench::MeshPass::init_pass(), blender::eevee::ForwardPipeline::material_transparent_add(), blender::eevee::ForwardPipeline::prepass_transparent_add(), blender::draw::select::SelectMap::select_bind(), blender::draw::select::SelectMap::select_bind(), blender::draw::select::SelectMap::select_bind(), state_set(), blender::eevee::ShadowPipeline::sync(), blender::eevee::VolumeLayer::sync(), blender::eevee::WorldPipeline::sync(), and blender::draw::test_draw_pass_all_commands().

◆ state_stencil()

template<class T>
void blender::draw::detail::PassBase< T >::state_stencil ( uint8_t write_mask,
uint8_t reference,
uint8_t compare_mask )
inline

Reminders:

  • compare_mask & reference is what is tested against compare_mask & stencil_value stencil_value being the value stored in the stencil buffer.
  • write-mask & reference is what gets written if the test condition is fulfilled.

This will modify the stencil state until another call to this function. If not specified before any draw-call, these states will be undefined.

For more information see: https://registry.khronos.org/vulkan/specs/1.3-extensions/man/html/VkStencilOpState.html

Definition at line 1101 of file draw_pass.hh.

References create_command(), state_stencil(), and blender::draw::command::StencilSet.

Referenced by blender::eevee::ShadowModule::begin_sync(), blender::eevee::DeferredLayer::end_sync(), blender::eevee::DeferredLayer::material_add(), state_stencil(), blender::eevee::VolumeLayer::sync(), and blender::draw::test_draw_pass_all_commands().

◆ sub()

◆ submit()

◆ subpass_transition()

template<class T>
void blender::draw::detail::PassBase< T >::subpass_transition ( GPUAttachmentState depth_attachment,
Span< GPUAttachmentState > color_attachments )
inline

Start a new sub-pass and change framebuffer attachments status.

Note
Affect the currently bound framebuffer at the time of submission and execution.
States are copied and stored in the command.

Definition at line 1118 of file draw_pass.hh.

References create_command(), GPU_ATTACHMENT_IGNORE, i, blender::Span< T >::index_range(), subpass_transition(), and blender::draw::command::SubPassTransition.

Referenced by blender::eevee::DeferredLayer::end_sync(), subpass_transition(), blender::eevee::ShadowPipeline::sync(), and blender::draw::test_draw_pass_all_commands().

◆ warm_shader_specialization()

◆ operator<<

template<typename DrawCommandBufType>
std::ostream & operator<< ( std::ostream & stream,
const PassBase< DrawCommandBufType > & pass )
friend

Definition at line 459 of file draw_pass.hh.

References PassBase(), and serialize().

Member Data Documentation

◆ commands_

template<typename DrawCommandBufType>
Vector<command::Undetermined, 0> blender::draw::detail::PassBase< DrawCommandBufType >::commands_
protected

Commands referenced by headers (which contains their types).

Definition at line 139 of file draw_pass.hh.

Referenced by create_command(), draw(), draw_expand(), blender::draw::Manager::generate_commands(), blender::draw::Manager::generate_commands(), serialize(), submit(), and warm_shader_specialization().

◆ debug_name

template<typename DrawCommandBufType>
const char* blender::draw::detail::PassBase< DrawCommandBufType >::debug_name

Definition at line 153 of file draw_pass.hh.

Referenced by PassBase(), serialize(), and submit().

◆ draw_commands_buf_

template<typename DrawCommandBufType>
DrawCommandBufType& blender::draw::detail::PassBase< DrawCommandBufType >::draw_commands_buf_
protected

◆ headers_

template<typename DrawCommandBufType>
Vector<command::Header, 0> blender::draw::detail::PassBase< DrawCommandBufType >::headers_
protected

◆ is_empty_

template<typename DrawCommandBufType>
bool blender::draw::detail::PassBase< DrawCommandBufType >::is_empty_ = true
protected

Definition at line 150 of file draw_pass.hh.

Referenced by create_command(), draw(), draw_expand(), and is_empty().

◆ manager_fingerprint_

template<typename DrawCommandBufType>
uint64_t blender::draw::detail::PassBase< DrawCommandBufType >::manager_fingerprint_ = 0
protected

◆ shader_

◆ sub_passes_

template<typename DrawCommandBufType>
SubPassVector<PassBase<DrawCommandBufType> >& blender::draw::detail::PassBase< DrawCommandBufType >::sub_passes_
protected

Reference to sub-pass commands buffer. Either own or from parent pass.

Definition at line 143 of file draw_pass.hh.

Referenced by blender::draw::Manager::generate_commands(), is_empty(), PassBase(), serialize(), sub(), blender::draw::PassSortable::sub(), submit(), and warm_shader_specialization().

◆ use_custom_ids

◆ view_fingerprint_

template<typename DrawCommandBufType>
uint64_t blender::draw::detail::PassBase< DrawCommandBufType >::view_fingerprint_ = 0
protected

The documentation for this class was generated from the following files: