Blender V4.3
PathTrace Class Reference

#include <path_trace.h>

Public Member Functions

 PathTrace (Device *device, Device *denoiser_device, Film *film, DeviceScene *device_scene, RenderScheduler &render_scheduler, TileManager &tile_manager)
 
 ~PathTrace ()
 
void load_kernels ()
 
void alloc_work_memory ()
 
bool ready_to_reset ()
 
void reset (const BufferParams &full_params, const BufferParams &big_tile_params, bool reset_rendering)
 
void device_free ()
 
void set_progress (Progress *progress)
 
void render (const RenderWork &render_work)
 
void set_denoiser_params (const DenoiseParams &params)
 
void set_adaptive_sampling (const AdaptiveSampling &adaptive_sampling)
 
void set_guiding_params (const GuidingParams &params, const bool reset)
 
void set_output_driver (unique_ptr< OutputDriver > driver)
 
void set_display_driver (unique_ptr< DisplayDriver > driver)
 
void clear_display ()
 
void draw ()
 
void flush_display ()
 
void cancel ()
 
void copy_to_render_buffers (RenderBuffers *render_buffers)
 
void copy_from_render_buffers (RenderBuffers *render_buffers)
 
bool copy_render_tile_from_device ()
 
void process_full_buffer_from_disk (string_view filename)
 
int get_num_render_tile_samples () const
 
bool get_render_tile_pixels (const PassAccessor &pass_accessor, const PassAccessor::Destination &destination)
 
bool set_render_tile_pixels (PassAccessor &pass_accessor, const PassAccessor::Source &source)
 
bool has_denoised_result () const
 
int2 get_render_tile_size () const
 
int2 get_render_tile_offset () const
 
int2 get_render_size () const
 
const BufferParamsget_render_tile_params () const
 
string full_report () const
 

Public Attributes

function< void(void)> progress_update_cb
 

Protected Member Functions

void render_pipeline (RenderWork render_work)
 
void render_init_kernel_execution ()
 
void update_work_buffer_params_if_needed (const RenderWork &render_work)
 
void update_allocated_work_buffer_params ()
 
void update_effective_work_buffer_params (const RenderWork &render_work)
 
void init_render_buffers (const RenderWork &render_work)
 
void path_trace (RenderWork &render_work)
 
void adaptive_sample (RenderWork &render_work)
 
void denoise (const RenderWork &render_work)
 
void cryptomatte_postprocess (const RenderWork &render_work)
 
void update_display (const RenderWork &render_work)
 
void rebalance (const RenderWork &render_work)
 
void write_tile_buffer (const RenderWork &render_work)
 
void finalize_full_buffer_on_disk (const RenderWork &render_work)
 
void guiding_update_structures ()
 
void guiding_prepare_structures ()
 
int get_num_samples_in_buffer ()
 
bool is_cancel_requested ()
 
void tile_buffer_write ()
 
void tile_buffer_read ()
 
void tile_buffer_write_to_disk ()
 
void progress_update_if_needed (const RenderWork &render_work)
 
void progress_set_status (const string &status, const string &substatus="")
 
void destroy_gpu_resources ()
 

Protected Attributes

Devicedevice_ = nullptr
 
Devicedenoise_device_ = nullptr
 
unique_ptr< Devicecpu_device_
 
Filmfilm_
 
DeviceScenedevice_scene_
 
RenderSchedulerrender_scheduler_
 
TileManagertile_manager_
 
unique_ptr< PathTraceDisplaydisplay_
 
unique_ptr< OutputDriveroutput_driver_
 
vector< unique_ptr< PathTraceWork > > path_trace_works_
 
vector< WorkBalanceInfowork_balance_infos_
 
BufferParams full_params_
 
BufferParams big_tile_params_
 
unique_ptr< Denoiserdenoiser_
 
unique_ptr< PathTraceWorkbig_tile_denoise_work_
 
struct { 
 
   bool   need_reset_params = false 
 
   int   resolution_divider = 0 
 
   BufferParams   effective_big_tile_params 
 
   bool   has_denoised_result = false 
 
   bool   tile_written = false 
 
render_state_ 
 
Progressprogress_
 
struct { 
 
   bool   is_rendering = false 
 
   bool   is_requested = false 
 
   thread_mutex   mutex 
 
   thread_condition_variable   condition 
 
render_cancel_ 
 
bool did_draw_after_reset_ = true
 
struct { 
 
   RenderBuffers *   render_buffers = nullptr 
 
full_frame_state_ 
 

Detailed Description

Definition at line 43 of file path_trace.h.

Constructor & Destructor Documentation

◆ PathTrace()

◆ ~PathTrace()

PathTrace::~PathTrace ( )

Definition at line 64 of file path_trace.cpp.

References destroy_gpu_resources().

Member Function Documentation

◆ adaptive_sample()

◆ alloc_work_memory()

void PathTrace::alloc_work_memory ( )

Definition at line 86 of file path_trace.cpp.

References path_trace_works_.

◆ cancel()

void PathTrace::cancel ( )

Definition at line 834 of file path_trace.cpp.

References lock, and render_cancel_.

◆ clear_display()

void PathTrace::clear_display ( )

Definition at line 645 of file path_trace.cpp.

References display_.

◆ copy_from_render_buffers()

void PathTrace::copy_from_render_buffers ( RenderBuffers * render_buffers)

Definition at line 967 of file path_trace.cpp.

References RenderBuffers::copy_from_device(), path_trace_works_, and render_buffers.

Referenced by rebalance().

◆ copy_render_tile_from_device()

bool PathTrace::copy_render_tile_from_device ( )

◆ copy_to_render_buffers()

void PathTrace::copy_to_render_buffers ( RenderBuffers * render_buffers)

◆ cryptomatte_postprocess()

void PathTrace::cryptomatte_postprocess ( const RenderWork & render_work)
protected

◆ denoise()

◆ destroy_gpu_resources()

void PathTrace::destroy_gpu_resources ( )
protected

Definition at line 1171 of file path_trace.cpp.

References big_tile_denoise_work_, display_, and path_trace_works_.

Referenced by set_display_driver(), and ~PathTrace().

◆ device_free()

void PathTrace::device_free ( )

◆ draw()

void PathTrace::draw ( )

Definition at line 652 of file path_trace.cpp.

References did_draw_after_reset_, and display_.

◆ finalize_full_buffer_on_disk()

void PathTrace::finalize_full_buffer_on_disk ( const RenderWork & render_work)
protected

◆ flush_display()

void PathTrace::flush_display ( )

Definition at line 661 of file path_trace.cpp.

References display_.

◆ full_report()

string PathTrace::full_report ( ) const

◆ get_num_render_tile_samples()

int PathTrace::get_num_render_tile_samples ( ) const

◆ get_num_samples_in_buffer()

int PathTrace::get_num_samples_in_buffer ( )
protected

Definition at line 847 of file path_trace.cpp.

References RenderScheduler::get_num_rendered_samples(), and render_scheduler_.

Referenced by denoise(), and update_display().

◆ get_render_size()

int2 PathTrace::get_render_size ( ) const

Definition at line 1152 of file path_trace.cpp.

References TileManager::get_size(), and tile_manager_.

◆ get_render_tile_offset()

int2 PathTrace::get_render_tile_offset ( ) const

◆ get_render_tile_params()

const BufferParams & PathTrace::get_render_tile_params ( ) const

◆ get_render_tile_pixels()

◆ get_render_tile_size()

int2 PathTrace::get_render_tile_size ( ) const

◆ guiding_prepare_structures()

void PathTrace::guiding_prepare_structures ( )
protected

◆ guiding_update_structures()

void PathTrace::guiding_update_structures ( )
protected

Definition at line 1449 of file path_trace.cpp.

References VLOG_DEBUG, and VLOG_WORK.

Referenced by render_pipeline().

◆ has_denoised_result()

bool PathTrace::has_denoised_result ( ) const

◆ init_render_buffers()

void PathTrace::init_render_buffers ( const RenderWork & render_work)
protected

◆ is_cancel_requested()

bool PathTrace::is_cancel_requested ( )
protected

Definition at line 852 of file path_trace.cpp.

References Progress::get_cancel(), progress_, and render_cancel_.

Referenced by adaptive_sample(), and path_trace().

◆ load_kernels()

void PathTrace::load_kernels ( )

Definition at line 69 of file path_trace.cpp.

References denoiser_, display_, path_trace_works_, and progress_.

◆ path_trace()

◆ process_full_buffer_from_disk()

◆ progress_set_status()

void PathTrace::progress_set_status ( const string & status,
const string & substatus = "" )
protected

Definition at line 951 of file path_trace.cpp.

References progress_, and Progress::set_status().

Referenced by process_full_buffer_from_disk().

◆ progress_update_if_needed()

void PathTrace::progress_update_if_needed ( const RenderWork & render_work)
protected

◆ ready_to_reset()

bool PathTrace::ready_to_reset ( )

Definition at line 93 of file path_trace.cpp.

References DCHECK, did_draw_after_reset_, and display_.

◆ rebalance()

◆ render()

void PathTrace::render ( const RenderWork & render_work)

Definition at line 158 of file path_trace.cpp.

References lock, render_cancel_, and render_pipeline().

◆ render_init_kernel_execution()

void PathTrace::render_init_kernel_execution ( )
protected

Definition at line 238 of file path_trace.cpp.

References path_trace_works_.

Referenced by render_pipeline().

◆ render_pipeline()

◆ reset()

void PathTrace::reset ( const BufferParams & full_params,
const BufferParams & big_tile_params,
bool reset_rendering )

◆ set_adaptive_sampling()

void PathTrace::set_adaptive_sampling ( const AdaptiveSampling & adaptive_sampling)

Definition at line 556 of file path_trace.cpp.

References render_scheduler_, and RenderScheduler::set_adaptive_sampling().

◆ set_denoiser_params()

◆ set_display_driver()

void PathTrace::set_display_driver ( unique_ptr< DisplayDriver > driver)

Definition at line 630 of file path_trace.cpp.

References destroy_gpu_resources(), and display_.

◆ set_guiding_params()

void PathTrace::set_guiding_params ( const GuidingParams & params,
const bool reset )

◆ set_output_driver()

void PathTrace::set_output_driver ( unique_ptr< OutputDriver > driver)

Definition at line 625 of file path_trace.cpp.

References output_driver_.

◆ set_progress()

void PathTrace::set_progress ( Progress * progress)

Definition at line 153 of file path_trace.cpp.

References progress_.

◆ set_render_tile_pixels()

bool PathTrace::set_render_tile_pixels ( PassAccessor & pass_accessor,
const PassAccessor::Source & source )

Definition at line 1114 of file path_trace.cpp.

References path_trace_works_.

Referenced by PathTraceTile::set_pass_pixels().

◆ tile_buffer_read()

void PathTrace::tile_buffer_read ( )
protected

Definition at line 877 of file path_trace.cpp.

References DeviceScene::data, device_scene_, output_driver_, path_trace_works_, and tile.

Referenced by init_render_buffers().

◆ tile_buffer_write()

void PathTrace::tile_buffer_write ( )
protected

Definition at line 867 of file path_trace.cpp.

References output_driver_, and tile.

Referenced by process_full_buffer_from_disk(), and write_tile_buffer().

◆ tile_buffer_write_to_disk()

◆ update_allocated_work_buffer_params()

◆ update_display()

◆ update_effective_work_buffer_params()

◆ update_work_buffer_params_if_needed()

void PathTrace::update_work_buffer_params_if_needed ( const RenderWork & render_work)
protected

◆ write_tile_buffer()

void PathTrace::write_tile_buffer ( const RenderWork & render_work)
protected

Member Data Documentation

◆ big_tile_denoise_work_

unique_ptr<PathTraceWork> PathTrace::big_tile_denoise_work_
protected

◆ big_tile_params_

◆ condition

thread_condition_variable PathTrace::condition

Definition at line 347 of file path_trace.h.

◆ cpu_device_

unique_ptr<Device> PathTrace::cpu_device_
protected

◆ denoise_device_

Device* PathTrace::denoise_device_ = nullptr
protected

Definition at line 257 of file path_trace.h.

Referenced by set_denoiser_params().

◆ denoiser_

unique_ptr<Denoiser> PathTrace::denoiser_
protected

◆ device_

Device* PathTrace::device_ = nullptr
protected

Definition at line 253 of file path_trace.h.

Referenced by PathTrace(), set_guiding_params(), and tile_buffer_write_to_disk().

◆ device_scene_

DeviceScene* PathTrace::device_scene_
protected

Definition at line 263 of file path_trace.h.

Referenced by denoise(), render_pipeline(), and tile_buffer_read().

◆ did_draw_after_reset_

bool PathTrace::did_draw_after_reset_ = true
protected

Definition at line 352 of file path_trace.h.

Referenced by draw(), ready_to_reset(), and reset().

◆ display_

unique_ptr<PathTraceDisplay> PathTrace::display_
protected

◆ effective_big_tile_params

BufferParams PathTrace::effective_big_tile_params

Definition at line 323 of file path_trace.h.

◆ film_

Film* PathTrace::film_
protected

Definition at line 262 of file path_trace.h.

Referenced by denoise().

◆ [struct]

◆ full_params_

BufferParams PathTrace::full_params_
protected

Definition at line 282 of file path_trace.h.

Referenced by reset(), update_display(), and update_effective_work_buffer_params().

◆ has_denoised_result

bool PathTrace::has_denoised_result = false

Definition at line 326 of file path_trace.h.

Referenced by PathTraceTile::get_pass_pixels().

◆ is_rendering

bool PathTrace::is_rendering = false

Definition at line 339 of file path_trace.h.

◆ is_requested

bool PathTrace::is_requested = false

Definition at line 342 of file path_trace.h.

◆ mutex

thread_mutex PathTrace::mutex

Definition at line 346 of file path_trace.h.

◆ need_reset_params

bool PathTrace::need_reset_params = false

Definition at line 313 of file path_trace.h.

◆ output_driver_

unique_ptr<OutputDriver> PathTrace::output_driver_
protected

◆ path_trace_works_

◆ progress_

◆ progress_update_cb

function<void(void)> PathTrace::progress_update_cb

Definition at line 184 of file path_trace.h.

Referenced by progress_update_if_needed().

◆ render_buffers

RenderBuffers* PathTrace::render_buffers = nullptr

Definition at line 356 of file path_trace.h.

Referenced by copy_from_render_buffers(), and copy_to_render_buffers().

◆ [struct]

struct { ... } PathTrace::render_cancel_

◆ render_scheduler_

◆ [struct]

◆ resolution_divider

int PathTrace::resolution_divider = 0

Definition at line 320 of file path_trace.h.

Referenced by update_effective_work_buffer_params().

◆ tile_manager_

◆ tile_written

bool PathTrace::tile_written = false

Definition at line 330 of file path_trace.h.

◆ work_balance_infos_

vector<WorkBalanceInfo> PathTrace::work_balance_infos_
protected

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