Blender V4.3
blender::draw::Manager Class Reference

#include <draw_manager.hh>

Classes

struct  DataDebugOutput
struct  SubmitDebugOutput

Public Member Functions

 Manager ()
 ~Manager ()
ResourceHandle unique_handle (const ObjectRef &ref)
ResourceHandle resource_handle (const ObjectRef &ref, float inflate_bounds=0.0f)
ResourceHandle resource_handle (const ObjectRef &ref, const float4x4 *model_matrix, const float3 *bounds_center, const float3 *bounds_half_extent)
ResourceHandle resource_handle (const float4x4 &model_matrix)
ResourceHandle resource_handle (const float4x4 &model_matrix, const float3 &bounds_center, const float3 &bounds_half_extent)
ResourceHandle resource_handle_for_psys (const ObjectRef &ref, const float4x4 &model_matrix)
ResourceHandle resource_handle_for_sculpt (const ObjectRef &ref)
void update_handle_bounds (ResourceHandle handle, const ObjectRef &ref, float inflate_bounds=0.0f)
void update_handle_bounds (ResourceHandle handle, const float3 &bounds_center, const float3 &bounds_half_extent)
void extract_object_attributes (ResourceHandle handle, const ObjectRef &ref, const GPUMaterial *material)
void extract_object_attributes (ResourceHandle handle, const ObjectRef &ref, Span< GPUMaterial * > materials)
void register_layer_attributes (GPUMaterial *material)
void submit (PassSimple &pass, View &view)
void submit (PassMain &pass, View &view)
void submit (PassSortable &pass, View &view)
void submit (PassSimple &pass)
SubmitDebugOutput submit_debug (PassSimple &pass, View &view)
SubmitDebugOutput submit_debug (PassMain &pass, View &view)
DataDebugOutput data_debug ()
void acquire_texture (GPUTexture *texture)
uint resource_handle_count () const
void begin_sync ()
void end_sync ()
void debug_bind ()
void resource_bind ()

Public Attributes

SwapChain< ObjectMatricesBuf, 2 > matrix_buf
SwapChain< ObjectBoundsBuf, 2 > bounds_buf
SwapChain< ObjectInfosBuf, 2 > infos_buf
ObjectAttributeBuf attributes_buf
ObjectAttributeLegacyBuf attributes_buf_legacy
Map< uint32_t, GPULayerAttrlayer_attributes
LayerAttributeBuf layer_attributes_buf
Vector< GPUTexture * > acquired_textures

Detailed Description

Definition at line 48 of file draw_manager.hh.

Constructor & Destructor Documentation

◆ Manager()

blender::draw::Manager::Manager ( )
inline

Definition at line 121 of file draw_manager.hh.

◆ ~Manager()

blender::draw::Manager::~Manager ( )

Definition at line 21 of file draw_manager.cc.

References acquired_textures, GPU_texture_free(), and texture.

Member Function Documentation

◆ acquire_texture()

void blender::draw::Manager::acquire_texture ( GPUTexture * texture)
inline

Will acquire the texture using ref counting and release it after drawing. To be used for texture coming from blender Image.

Definition at line 222 of file draw_manager.hh.

References acquired_textures, GPU_texture_ref(), and texture.

Referenced by blender::draw::detail::PassBase< DrawCommandBufType >::material_set().

◆ begin_sync()

◆ data_debug()

Manager::DataDebugOutput blender::draw::Manager::data_debug ( )

Check data buffers of the draw manager. Only to be used after end_sync().

Definition at line 262 of file draw_manager.cc.

References bounds_buf, infos_buf, matrix_buf, and output.

Referenced by blender::draw::test_draw_manager_sync().

◆ debug_bind()

◆ end_sync()

◆ extract_object_attributes() [1/2]

void blender::draw::Manager::extract_object_attributes ( ResourceHandle handle,
const ObjectRef & ref,
const GPUMaterial * material )
inline

Populate additional per resource data on demand. IMPORTANT: Should be called only once per object.

Definition at line 329 of file draw_manager.hh.

References attributes_buf, GPU_material_uniform_attributes(), infos_buf, GPUUniformAttrList::list, LISTBASE_FOREACH, ObjectInfos::object_attrs_len, ObjectInfos::object_attrs_offset, and blender::draw::ResourceHandle::resource_index().

◆ extract_object_attributes() [2/2]

◆ register_layer_attributes()

void blender::draw::Manager::register_layer_attributes ( GPUMaterial * material)
inline

Collect necessary View Layer attributes.

Since layer attributes are global to the whole render pass, this only collects a table of their names.

Definition at line 380 of file draw_manager.hh.

References GPU_material_layer_attributes(), layer_attributes, and LISTBASE_FOREACH.

◆ resource_bind()

◆ resource_handle() [1/4]

ResourceHandle blender::draw::Manager::resource_handle ( const float4x4 & model_matrix)
inline

Get resource id for a loose matrix. The draw-calls for this resource handle won't be culled and there won't be any associated object info / bounds. Assumes correct handedness / winding.

Definition at line 287 of file draw_manager.hh.

References bounds_buf, infos_buf, and matrix_buf.

◆ resource_handle() [2/4]

ResourceHandle blender::draw::Manager::resource_handle ( const float4x4 & model_matrix,
const float3 & bounds_center,
const float3 & bounds_half_extent )
inline

Get resource id for a loose matrix with bounds. The draw-calls for this resource handle will be culled but there won't be any associated object info / bounds. Assumes correct handedness / winding.

Definition at line 295 of file draw_manager.hh.

References bounds_buf, infos_buf, and matrix_buf.

◆ resource_handle() [3/4]

ResourceHandle blender::draw::Manager::resource_handle ( const ObjectRef & ref,
const float4x4 * model_matrix,
const float3 * bounds_center,
const float3 * bounds_half_extent )
inline

Create a new resource handle for the given object, but optionally override model matrix and bounds.

Definition at line 265 of file draw_manager.hh.

References bounds_buf, blender::draw::ObjectRef::dupli_object, blender::draw::ObjectRef::dupli_parent, infos_buf, matrix_buf, OB_NEG_SCALE, blender::draw::ObjectRef::object, and Object::transflag.

◆ resource_handle() [4/4]

◆ resource_handle_count()

uint blender::draw::Manager::resource_handle_count ( ) const
inline

Return the number of resource handles allocated.

Definition at line 231 of file draw_manager.hh.

Referenced by blender::eevee::IrradianceBake::surfels_create().

◆ resource_handle_for_psys()

ResourceHandle blender::draw::Manager::resource_handle_for_psys ( const ObjectRef & ref,
const float4x4 & model_matrix )
inline

Get resource id for particle system. The draw-calls for this resource won't be culled. The associated object info will contain the info from its parent object.

Definition at line 305 of file draw_manager.hh.

References bounds_buf, blender::draw::ObjectRef::dupli_object, blender::draw::ObjectRef::dupli_parent, infos_buf, matrix_buf, OB_NEG_SCALE, blender::draw::ObjectRef::object, and Object::transflag.

Referenced by blender::draw::overlay::Particles::edit_object_sync(), blender::draw::overlay::Particles::object_sync(), and blender::draw::overlay::Prepass::particle_sync().

◆ resource_handle_for_sculpt()

◆ submit() [1/4]

◆ submit() [2/4]

◆ submit() [3/4]

void blender::draw::Manager::submit ( PassSimple & pass,
View & view )

Submit a pass for drawing. All resource reference will be dereferenced and commands will be sent to GPU.

Definition at line 161 of file draw_manager.cc.

References blender::draw::detail::PassBase< DrawCommandBufType >::commands_, debug_bind(), blender::draw::detail::PassBase< DrawCommandBufType >::draw_commands_buf_, blender::draw::detail::PassBase< DrawCommandBufType >::headers_, resource_bind(), state, blender::draw::detail::PassBase< DrawCommandBufType >::sub_passes_, blender::draw::detail::PassBase< DrawCommandBufType >::submit(), and view.

Referenced by blender::eevee::Film::cryptomatte_sort(), blender::draw::curves_update(), blender::eevee::DeferredPipeline::debug_draw(), blender::eevee::Film::display(), blender::draw::overlay::AntiAliasing::draw(), blender::draw::overlay::Armatures::draw(), blender::draw::overlay::AttributeViewer::draw(), blender::draw::overlay::Background::draw(), blender::draw::overlay::Bounds::draw(), blender::draw::overlay::Cameras::draw(), blender::draw::overlay::Curves::draw(), blender::draw::overlay::EditText::draw(), blender::draw::overlay::Empties::draw(), blender::draw::overlay::Facing::draw(), blender::draw::overlay::Fade::draw(), blender::draw::overlay::Fluids::draw(), blender::draw::overlay::ForceFields::draw(), blender::draw::overlay::GreasePencil::draw(), blender::draw::overlay::Grid::draw(), blender::draw::overlay::Lattices::draw(), blender::draw::overlay::LightProbes::draw(), blender::draw::overlay::Lights::draw(), blender::draw::overlay::Meshes::draw(), blender::draw::overlay::MeshUVs::draw(), blender::draw::overlay::Metaballs::draw(), blender::draw::overlay::ModeTransfer::draw(), blender::draw::overlay::Origins::draw(), blender::draw::overlay::Outline::draw(), blender::draw::overlay::Paints::draw(), blender::draw::overlay::Particles::draw(), blender::draw::overlay::Prepass::draw(), blender::draw::overlay::Relations::draw(), blender::draw::overlay::Sculpts::draw(), blender::draw::overlay::Speakers::draw(), blender::draw::overlay::Wireframe::draw(), blender::draw::overlay::XrayFade::draw(), blender::workbench::AntiAliasingPass::draw(), blender::workbench::DofPass::draw(), blender::workbench::OpaquePass::draw(), blender::workbench::OutlinePass::draw(), blender::workbench::ShadowPass::draw(), blender::workbench::TransparentDepthPass::draw(), blender::workbench::TransparentPass::draw(), blender::workbench::VolumePass::draw(), blender::draw::overlay::Cameras::draw_background_images(), blender::draw::overlay::Empties::draw_background_images(), blender::draw::overlay::Curves::draw_color_only(), blender::draw::overlay::GreasePencil::draw_color_only(), blender::draw::overlay::LightProbes::draw_color_only(), blender::draw::overlay::Meshes::draw_color_only(), blender::draw::overlay::MotionPath::draw_color_only(), blender::draw::overlay::Empties::draw_images(), blender::draw::overlay::Cameras::draw_in_front(), blender::draw::overlay::Empties::draw_in_front_images(), blender::draw::overlay::Particles::draw_no_line(), blender::draw::overlay::MeshUVs::draw_on_render(), blender::draw::overlay::Sculpts::draw_on_render(), blender::draw::overlay::Cameras::draw_scene_background_images(), blender::workbench::StencilViewWorkaround::extract(), blender::draw::hair_update(), blender::eevee::Precompute::Precompute(), blender::eevee::DepthOfField::render(), submit(), submit_debug(), submit_debug(), 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().

◆ submit() [4/4]

void blender::draw::Manager::submit ( PassSortable & pass,
View & view )

Definition at line 209 of file draw_manager.cc.

References blender::draw::PassSortable::sort(), submit(), and view.

◆ submit_debug() [1/2]

◆ submit_debug() [2/2]

Manager::SubmitDebugOutput blender::draw::Manager::submit_debug ( PassSimple & pass,
View & view )

Submit a pass for drawing but read back all data buffers for inspection.

Definition at line 231 of file draw_manager.cc.

References blender::draw::detail::PassBase< DrawCommandBufType >::draw_commands_buf_, output, submit(), and view.

Referenced by blender::draw::test_draw_resource_id_gen(), and blender::draw::test_draw_visibility().

◆ unique_handle()

◆ update_handle_bounds() [1/2]

void blender::draw::Manager::update_handle_bounds ( ResourceHandle handle,
const float3 & bounds_center,
const float3 & bounds_half_extent )
inline

Update the bounds of an already created handle.

Definition at line 322 of file draw_manager.hh.

References bounds_buf, and blender::draw::ResourceHandle::resource_index().

◆ update_handle_bounds() [2/2]

void blender::draw::Manager::update_handle_bounds ( ResourceHandle handle,
const ObjectRef & ref,
float inflate_bounds = 0.0f )
inline

Update the bounds of an already created handle.

Definition at line 315 of file draw_manager.hh.

References bounds_buf, blender::draw::ObjectRef::object, and blender::draw::ResourceHandle::resource_index().

Member Data Documentation

◆ acquired_textures

Vector<GPUTexture *> blender::draw::Manager::acquired_textures

List of textures coming from Image data-blocks. They need to be reference-counted in order to avoid being freed in another thread.

Definition at line 110 of file draw_manager.hh.

Referenced by acquire_texture(), begin_sync(), and ~Manager().

◆ attributes_buf

ObjectAttributeBuf blender::draw::Manager::attributes_buf

Object Attributes are reference by indirection data inside ObjectInfos. This is because attribute list is arbitrary.

Definition at line 89 of file draw_manager.hh.

Referenced by begin_sync(), end_sync(), extract_object_attributes(), extract_object_attributes(), and resource_bind().

◆ attributes_buf_legacy

ObjectAttributeLegacyBuf blender::draw::Manager::attributes_buf_legacy

TODO(@fclem): Remove once we get rid of old EEVEE code-base. Only here to satisfy bindings.

Definition at line 94 of file draw_manager.hh.

Referenced by end_sync(), and resource_bind().

◆ bounds_buf

◆ infos_buf

◆ layer_attributes

Map<uint32_t, GPULayerAttr> blender::draw::Manager::layer_attributes

Table of all View Layer attributes required by shaders, used to populate the buffer below.

Definition at line 99 of file draw_manager.hh.

Referenced by begin_sync(), and register_layer_attributes().

◆ layer_attributes_buf

LayerAttributeBuf blender::draw::Manager::layer_attributes_buf

Buffer of layer attribute values, indexed and sorted by the hash.

Definition at line 104 of file draw_manager.hh.

Referenced by end_sync(), and resource_bind().

◆ matrix_buf

SwapChain<ObjectMatricesBuf, 2> blender::draw::Manager::matrix_buf

Buffers containing all object data. Referenced by resource index. Exposed as public members for shader access after sync.

Definition at line 81 of file draw_manager.hh.

Referenced by begin_sync(), data_debug(), end_sync(), resource_bind(), resource_handle(), resource_handle(), resource_handle(), resource_handle(), and resource_handle_for_psys().


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