Blender  V2.93
Classes | Public Member Functions | Public Attributes | Protected Types | Protected Member Functions | Protected Attributes | List of all members
Session Class Reference

#include <session.h>

Classes

struct  DelayedReset
 

Public Member Functions

 Session (const SessionParams &params)
 
 ~Session ()
 
void start ()
 
void cancel ()
 
bool draw (BufferParams &params, DeviceDrawParams &draw_params)
 
void wait ()
 
bool ready_to_reset ()
 
void reset (BufferParams &params, int samples)
 
void set_pause (bool pause)
 
void set_samples (int samples)
 
void set_denoising (const DenoiseParams &denoising)
 
void set_denoising_start_sample (int sample)
 
bool update_scene ()
 
void device_free ()
 
float get_progress ()
 
void collect_statistics (RenderStats *stats)
 

Public Attributes

Devicedevice
 
Scenescene
 
RenderBuffersbuffers
 
DisplayBufferdisplay
 
Progress progress
 
SessionParams params
 
TileManager tile_manager
 
Stats stats
 
Profiler profiler
 
function< void(RenderTile &)> write_render_tile_cb
 
function< void(RenderTile &, bool)> update_render_tile_cb
 
function< void(RenderTile &)> read_bake_tile_cb
 

Protected Types

enum  TileStealingState { NOT_STEALING , WAITING_FOR_TILE , RELEASING_TILE , GOT_TILE }
 

Protected Member Functions

void run ()
 
void update_status_time (bool show_pause=false, bool show_done=false)
 
void render (bool use_denoise)
 
void copy_to_display_buffer (int sample)
 
void reset_ (BufferParams &params, int samples)
 
void run_cpu ()
 
bool draw_cpu (BufferParams &params, DeviceDrawParams &draw_params)
 
void reset_cpu (BufferParams &params, int samples)
 
void run_gpu ()
 
bool draw_gpu (BufferParams &params, DeviceDrawParams &draw_params)
 
void reset_gpu (BufferParams &params, int samples)
 
bool render_need_denoise (bool &delayed)
 
bool steal_tile (RenderTile &tile, Device *tile_device, thread_scoped_lock &tile_lock)
 
bool get_tile_stolen ()
 
bool acquire_tile (RenderTile &tile, Device *tile_device, uint tile_types)
 
void update_tile_sample (RenderTile &tile)
 
void release_tile (RenderTile &tile, const bool need_denoise)
 
void map_neighbor_tiles (RenderTileNeighbors &neighbors, Device *tile_device)
 
void unmap_neighbor_tiles (RenderTileNeighbors &neighbors, Device *tile_device)
 
bool update_progressive_refine (bool cancel)
 

Protected Attributes

struct Session::DelayedReset delayed_reset
 
bool device_use_gl
 
threadsession_thread
 
volatile bool display_outdated
 
volatile bool gpu_draw_ready
 
volatile bool gpu_need_display_buffer_update
 
thread_condition_variable gpu_need_display_buffer_update_cond
 
bool pause
 
thread_condition_variable pause_cond
 
thread_mutex pause_mutex
 
thread_mutex tile_mutex
 
thread_mutex buffers_mutex
 
thread_mutex display_mutex
 
thread_condition_variable denoising_cond
 
thread_condition_variable tile_steal_cond
 
double reset_time
 
double last_update_time
 
double last_display_time
 
RenderTile stolen_tile
 
std::atomic< TileStealingStatetile_stealing_state
 
int stealable_tiles
 

Detailed Description

Definition at line 130 of file session.h.

Member Enumeration Documentation

◆ TileStealingState

Enumerator
NOT_STEALING 
WAITING_FOR_TILE 
RELEASING_TILE 
GOT_TILE 

Definition at line 231 of file session.h.

Constructor & Destructor Documentation

◆ Session()

CCL_NAMESPACE_BEGIN Session::Session ( const SessionParams params)
explicit

◆ ~Session()

Session::~Session ( )

Member Function Documentation

◆ acquire_tile()

bool Session::acquire_tile ( RenderTile tile,
Device tile_device,
uint  tile_types 
)
protected

Definition at line 441 of file session.cpp.

References RenderTile::BAKE, RenderBuffers::buffer, RenderTile::buffer, TileManager::State::buffer, RenderTile::buffers, buffers, Tile::buffers, RenderTile::CAN_BE_STOLEN, device_vector< T >::copy_to_device(), device_memory::data_height, device_memory::data_width, RenderTile::DENOISE, Tile::DENOISE, denoising_cond, device_memory::device, device, DEVICE_CPU, Device::device_number(), device_memory::device_pointer, BufferParams::full_x, BufferParams::full_y, Progress::get_cancel(), BufferParams::get_offset_stride(), BufferParams::get_passes_size(), RenderTile::h, Tile::h, TileManager::has_tiles(), BufferParams::height, Tile::index, Device::info, RenderBuffers::map_neighbor_copied, Device::map_tile(), device_vector< T >::move_device(), TileManager::next_tile(), RenderTile::NO_STEALING, NULL, RenderTile::num_samples, TileManager::State::num_samples, RenderTile::offset, RenderBuffers::params, params, TileManager::params, RenderTile::PATH_TRACE, progress, SessionParams::progressive_refine, TileManager::range_start_sample, read_bake_tile_cb, RenderBuffers::reset(), RenderTile::resolution, TileManager::State::resolution_divider, RenderTile::sample, TileManager::State::sample, RenderTile::start_sample, Tile::state, TileManager::state, steal_tile(), stealable_tiles, RenderTile::stealing_state, RenderTile::stride, RenderTile::task, RenderTile::tile_index, tile_manager, tile_mutex, DeviceInfo::type, update_tile_sample(), RenderTile::w, Tile::w, BufferParams::width, RenderTile::x, Tile::x, RenderTile::y, and Tile::y.

Referenced by render().

◆ cancel()

void Session::cancel ( )

◆ collect_statistics()

void Session::collect_statistics ( RenderStats stats)

◆ copy_to_display_buffer()

void Session::copy_to_display_buffer ( int  sample)
protected

◆ device_free()

void Session::device_free ( )

Definition at line 1290 of file session.cpp.

References Scene::device_free(), TileManager::device_free(), scene, and tile_manager.

◆ draw()

bool Session::draw ( BufferParams params,
DeviceDrawParams draw_params 
)

Definition at line 897 of file session.cpp.

References device_use_gl, draw_cpu(), and draw_gpu().

Referenced by BlenderSession::draw().

◆ draw_cpu()

bool Session::draw_cpu ( BufferParams params,
DeviceDrawParams draw_params 
)
protected

◆ draw_gpu()

bool Session::draw_gpu ( BufferParams params,
DeviceDrawParams draw_params 
)
protected

◆ get_progress()

float Session::get_progress ( )

◆ get_tile_stolen()

bool Session::get_tile_stolen ( )
protected

Definition at line 433 of file session.cpp.

References RELEASING_TILE, tile_stealing_state, and WAITING_FOR_TILE.

Referenced by render().

◆ map_neighbor_tiles()

void Session::map_neighbor_tiles ( RenderTileNeighbors neighbors,
Device tile_device 
)
protected

◆ ready_to_reset()

bool Session::ready_to_reset ( )

◆ release_tile()

void Session::release_tile ( RenderTile tile,
const bool  need_denoise 
)
protected

◆ render()

void Session::render ( bool  use_denoise)
protected

◆ render_need_denoise()

bool Session::render_need_denoise ( bool &  delayed)
protected

◆ reset()

void Session::reset ( BufferParams params,
int  samples 
)

◆ reset_()

void Session::reset_ ( BufferParams params,
int  samples 
)
protected

◆ reset_cpu()

void Session::reset_cpu ( BufferParams params,
int  samples 
)
protected

◆ reset_gpu()

void Session::reset_gpu ( BufferParams params,
int  samples 
)
protected

◆ run()

void Session::run ( )
protected

◆ run_cpu()

void Session::run_cpu ( )
protected

◆ run_gpu()

void Session::run_gpu ( )
protected

◆ set_denoising()

void Session::set_denoising ( const DenoiseParams denoising)

◆ set_denoising_start_sample()

void Session::set_denoising_start_sample ( int  sample)

◆ set_pause()

void Session::set_pause ( bool  pause)

◆ set_samples()

void Session::set_samples ( int  samples)

◆ start()

void Session::start ( )

◆ steal_tile()

bool Session::steal_tile ( RenderTile tile,
Device tile_device,
thread_scoped_lock tile_lock 
)
protected

◆ unmap_neighbor_tiles()

void Session::unmap_neighbor_tiles ( RenderTileNeighbors neighbors,
Device tile_device 
)
protected

Definition at line 719 of file session.cpp.

References device, tile_mutex, and Device::unmap_neighbor_tiles().

Referenced by render().

◆ update_progressive_refine()

bool Session::update_progressive_refine ( bool  cancel)
protected

◆ update_scene()

bool Session::update_scene ( )

◆ update_status_time()

void Session::update_status_time ( bool  show_pause = false,
bool  show_done = false 
)
protected

◆ update_tile_sample()

void Session::update_tile_sample ( RenderTile tile)
protected

◆ wait()

void Session::wait ( )

Definition at line 1003 of file session.cpp.

References thread::join(), NULL, and session_thread.

Referenced by BlenderSession::bake(), cancel(), main(), and BlenderSession::render().

Member Data Documentation

◆ buffers

RenderBuffers* Session::buffers

◆ buffers_mutex

thread_mutex Session::buffers_mutex
protected

Definition at line 221 of file session.h.

Referenced by draw_gpu(), reset_gpu(), run_cpu(), run_gpu(), and set_denoising().

◆ delayed_reset

struct Session::DelayedReset Session::delayed_reset
protected

Referenced by reset_cpu(), run_cpu(), and Session().

◆ denoising_cond

thread_condition_variable Session::denoising_cond
protected

Definition at line 223 of file session.h.

Referenced by acquire_tile(), and release_tile().

◆ device

Device* Session::device

◆ device_use_gl

bool Session::device_use_gl
protected

Definition at line 207 of file session.h.

Referenced by draw(), reset(), run(), and Session().

◆ display

DisplayBuffer* Session::display

Definition at line 135 of file session.h.

Referenced by copy_to_display_buffer(), draw_cpu(), draw_gpu(), reset_(), Session(), and ~Session().

◆ display_mutex

thread_mutex Session::display_mutex
protected

Definition at line 222 of file session.h.

Referenced by draw_cpu(), draw_gpu(), reset_gpu(), and run_cpu().

◆ display_outdated

volatile bool Session::display_outdated
protected

◆ gpu_draw_ready

volatile bool Session::gpu_draw_ready
protected

Definition at line 213 of file session.h.

Referenced by draw_gpu(), reset_(), run_gpu(), and Session().

◆ gpu_need_display_buffer_update

volatile bool Session::gpu_need_display_buffer_update
protected

Definition at line 214 of file session.h.

Referenced by cancel(), draw_gpu(), reset_gpu(), run_gpu(), and Session().

◆ gpu_need_display_buffer_update_cond

thread_condition_variable Session::gpu_need_display_buffer_update_cond
protected

Definition at line 215 of file session.h.

Referenced by cancel(), draw_gpu(), reset_gpu(), and run_gpu().

◆ last_display_time

double Session::last_display_time
protected

Definition at line 228 of file session.h.

Referenced by copy_to_display_buffer(), render_need_denoise(), run_cpu(), and run_gpu().

◆ last_update_time

double Session::last_update_time
protected

Definition at line 227 of file session.h.

Referenced by run_cpu(), run_gpu(), Session(), and update_progressive_refine().

◆ params

SessionParams Session::params

◆ pause

bool Session::pause
protected

Definition at line 217 of file session.h.

Referenced by cancel(), run_cpu(), run_gpu(), Session(), and set_pause().

◆ pause_cond

thread_condition_variable Session::pause_cond
protected

◆ pause_mutex

thread_mutex Session::pause_mutex
protected

Definition at line 219 of file session.h.

Referenced by cancel(), reset_cpu(), reset_gpu(), run_cpu(), run_gpu(), and set_pause().

◆ profiler

Profiler Session::profiler

Definition at line 140 of file session.h.

Referenced by collect_statistics(), run(), run_cpu(), run_gpu(), and Session().

◆ progress

Progress Session::progress

◆ read_bake_tile_cb

function<void(RenderTile &)> Session::read_bake_tile_cb

Definition at line 144 of file session.h.

Referenced by acquire_tile(), BlenderSession::bake(), and render_need_denoise().

◆ reset_time

double Session::reset_time
protected

Definition at line 226 of file session.h.

Referenced by draw_cpu(), draw_gpu(), ready_to_reset(), reset_cpu(), reset_gpu(), run_gpu(), and Session().

◆ scene

Scene* Session::scene

◆ session_thread

thread* Session::session_thread
protected

Definition at line 209 of file session.h.

Referenced by cancel(), Session(), set_pause(), start(), and wait().

◆ stats

Stats Session::stats

◆ stealable_tiles

int Session::stealable_tiles
protected

Definition at line 238 of file session.h.

Referenced by acquire_tile(), release_tile(), reset_(), and steal_tile().

◆ stolen_tile

RenderTile Session::stolen_tile
protected

Definition at line 230 of file session.h.

Referenced by release_tile(), and steal_tile().

◆ tile_manager

TileManager Session::tile_manager

◆ tile_mutex

thread_mutex Session::tile_mutex
protected

◆ tile_steal_cond

thread_condition_variable Session::tile_steal_cond
protected

Definition at line 224 of file session.h.

Referenced by release_tile(), and steal_tile().

◆ tile_stealing_state

std::atomic<TileStealingState> Session::tile_stealing_state
protected

Definition at line 237 of file session.h.

Referenced by get_tile_stolen(), release_tile(), reset_(), and steal_tile().

◆ update_render_tile_cb

function<void(RenderTile &, bool)> Session::update_render_tile_cb

◆ write_render_tile_cb

function<void(RenderTile &)> Session::write_render_tile_cb

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