[Bf-blender-cvs] [69c9363e399] master: Cleanup: Use conventional naming for private Session members
Sergey Sharybin
noreply at git.blender.org
Fri Aug 6 15:56:06 CEST 2021
Commit: 69c9363e39957a47f7d18e8a24d048cbb99df3b5
Author: Sergey Sharybin
Date: Fri Aug 6 15:53:05 2021 +0200
Branches: master
https://developer.blender.org/rB69c9363e39957a47f7d18e8a24d048cbb99df3b5
Cleanup: Use conventional naming for private Session members
Makes it consistent with the guidelines and the Cycles X branch, and
allows to backport fix for the viewport update from the branch. Will
cause a merge conflict, which should be simple accept-ours in the
branch.
===================================================================
M intern/cycles/render/session.cpp
M intern/cycles/render/session.h
===================================================================
diff --git a/intern/cycles/render/session.cpp b/intern/cycles/render/session.cpp
index 19d4a66353d..6b50522b660 100644
--- a/intern/cycles/render/session.cpp
+++ b/intern/cycles/render/session.cpp
@@ -57,23 +57,23 @@ Session::Session(const SessionParams ¶ms_)
stats(),
profiler()
{
- device_use_gl = ((params.device.type != DEVICE_CPU) && !params.background);
+ device_use_gl_ = ((params.device.type != DEVICE_CPU) && !params.background);
TaskScheduler::init(params.threads);
- session_thread = NULL;
+ session_thread_ = NULL;
scene = NULL;
- reset_time = 0.0;
- last_update_time = 0.0;
+ reset_time_ = 0.0;
+ last_update_time_ = 0.0;
- delayed_reset.do_reset = false;
- delayed_reset.samples = 0;
+ delayed_reset_.do_reset = false;
+ delayed_reset_.samples = 0;
- display_outdated = false;
- gpu_draw_ready = false;
- gpu_need_display_buffer_update = false;
- pause = false;
+ display_outdated_ = false;
+ gpu_draw_ready_ = false;
+ gpu_need_display_buffer_update_ = false;
+ pause_ = false;
buffers = NULL;
display = NULL;
@@ -127,25 +127,25 @@ Session::~Session()
void Session::start()
{
- if (!session_thread) {
- session_thread = new thread(function_bind(&Session::run, this));
+ if (!session_thread_) {
+ session_thread_ = new thread(function_bind(&Session::run, this));
}
}
void Session::cancel()
{
- if (session_thread) {
+ if (session_thread_) {
/* wait for session thread to end */
progress.set_cancel("Exiting");
- gpu_need_display_buffer_update = false;
- gpu_need_display_buffer_update_cond.notify_all();
+ gpu_need_display_buffer_update_ = false;
+ gpu_need_display_buffer_update_cond_.notify_all();
{
- thread_scoped_lock pause_lock(pause_mutex);
- pause = false;
+ thread_scoped_lock pause_lock(pause_mutex_);
+ pause_ = false;
}
- pause_cond.notify_all();
+ pause_cond_.notify_all();
wait();
}
@@ -153,9 +153,9 @@ void Session::cancel()
bool Session::ready_to_reset()
{
- double dt = time_dt() - reset_time;
+ double dt = time_dt() - reset_time_;
- if (!display_outdated)
+ if (!display_outdated_)
return (dt > params.reset_timeout);
else
return (dt > params.cancel_timeout);
@@ -165,48 +165,48 @@ bool Session::ready_to_reset()
void Session::reset_gpu(BufferParams &buffer_params, int samples)
{
- thread_scoped_lock pause_lock(pause_mutex);
+ thread_scoped_lock pause_lock(pause_mutex_);
/* block for buffer access and reset immediately. we can't do this
* in the thread, because we need to allocate an OpenGL buffer, and
* that only works in the main thread */
- thread_scoped_lock display_lock(display_mutex);
- thread_scoped_lock buffers_lock(buffers_mutex);
+ thread_scoped_lock display_lock(display_mutex_);
+ thread_scoped_lock buffers_lock(buffers_mutex_);
- display_outdated = true;
- reset_time = time_dt();
+ display_outdated_ = true;
+ reset_time_ = time_dt();
reset_(buffer_params, samples);
- gpu_need_display_buffer_update = false;
- gpu_need_display_buffer_update_cond.notify_all();
+ gpu_need_display_buffer_update_ = false;
+ gpu_need_display_buffer_update_cond_.notify_all();
- pause_cond.notify_all();
+ pause_cond_.notify_all();
}
bool Session::draw_gpu(BufferParams &buffer_params, DeviceDrawParams &draw_params)
{
/* block for buffer access */
- thread_scoped_lock display_lock(display_mutex);
+ thread_scoped_lock display_lock(display_mutex_);
/* first check we already rendered something */
- if (gpu_draw_ready) {
+ if (gpu_draw_ready_) {
/* then verify the buffers have the expected size, so we don't
* draw previous results in a resized window */
if (buffer_params.width == display->params.width &&
buffer_params.height == display->params.height) {
/* for CUDA we need to do tone-mapping still, since we can
* only access GL buffers from the main thread. */
- if (gpu_need_display_buffer_update) {
- thread_scoped_lock buffers_lock(buffers_mutex);
+ if (gpu_need_display_buffer_update_) {
+ thread_scoped_lock buffers_lock(buffers_mutex_);
copy_to_display_buffer(tile_manager.state.sample);
- gpu_need_display_buffer_update = false;
- gpu_need_display_buffer_update_cond.notify_all();
+ gpu_need_display_buffer_update_ = false;
+ gpu_need_display_buffer_update_cond_.notify_all();
}
display->draw(device, draw_params);
- if (display_outdated && (time_dt() - reset_time) > params.text_timeout)
+ if (display_outdated_ && (time_dt() - reset_time_) > params.text_timeout)
return false;
return true;
@@ -220,9 +220,9 @@ void Session::run_gpu()
{
bool tiles_written = false;
- reset_time = time_dt();
- last_update_time = time_dt();
- last_display_time = last_update_time;
+ reset_time_ = time_dt();
+ last_update_time_ = time_dt();
+ last_display_time_ = last_update_time_;
progress.set_render_start_time();
@@ -255,7 +255,7 @@ void Session::run_gpu()
/* buffers mutex is locked entirely while rendering each
* sample, and released/reacquired on each iteration to allow
* reset and draw in between */
- thread_scoped_lock buffers_lock(buffers_mutex);
+ thread_scoped_lock buffers_lock(buffers_mutex_);
/* update status and timing */
update_status_time();
@@ -273,17 +273,17 @@ void Session::run_gpu()
/* update status and timing */
update_status_time();
- gpu_need_display_buffer_update = !delayed_denoise;
- gpu_draw_ready = true;
+ gpu_need_display_buffer_update_ = !delayed_denoise;
+ gpu_draw_ready_ = true;
progress.set_update();
/* wait for until display buffer is updated */
if (!params.background) {
- while (gpu_need_display_buffer_update) {
+ while (gpu_need_display_buffer_update_) {
if (progress.get_cancel())
break;
- gpu_need_display_buffer_update_cond.wait(buffers_lock);
+ gpu_need_display_buffer_update_cond_.wait(buffers_lock);
}
}
@@ -305,23 +305,23 @@ void Session::run_gpu()
void Session::reset_cpu(BufferParams &buffer_params, int samples)
{
- thread_scoped_lock reset_lock(delayed_reset.mutex);
- thread_scoped_lock pause_lock(pause_mutex);
+ thread_scoped_lock reset_lock(delayed_reset_.mutex);
+ thread_scoped_lock pause_lock(pause_mutex_);
- display_outdated = true;
- reset_time = time_dt();
+ display_outdated_ = true;
+ reset_time_ = time_dt();
- delayed_reset.params = buffer_params;
- delayed_reset.samples = samples;
- delayed_reset.do_reset = true;
+ delayed_reset_.params = buffer_params;
+ delayed_reset_.samples = samples;
+ delayed_reset_.do_reset = true;
device->task_cancel();
- pause_cond.notify_all();
+ pause_cond_.notify_all();
}
bool Session::draw_cpu(BufferParams &buffer_params, DeviceDrawParams &draw_params)
{
- thread_scoped_lock display_lock(display_mutex);
+ thread_scoped_lock display_lock(display_mutex_);
/* first check we already rendered something */
if (display->draw_ready()) {
@@ -331,7 +331,7 @@ bool Session::draw_cpu(BufferParams &buffer_params, DeviceDrawParams &draw_param
buffer_params.height == display->params.height) {
display->draw(device, draw_params);
- if (display_outdated && (time_dt() - reset_time) > params.text_timeout)
+ if (display_outdated_ && (time_dt() - reset_time_) > params.text_timeout)
return false;
return true;
@@ -345,46 +345,46 @@ bool Session::steal_tile(RenderTile &rtile, Device *tile_device, thread_scoped_l
{
/* Devices that can get their tiles stolen don't steal tiles themselves.
* Additionally, if there are no stealable tiles in flight, give up here. */
- if (tile_device->info.type == DEVICE_CPU || stealable_tiles == 0) {
+ if (tile_device->info.type == DEVICE_CPU || stealable_tiles_ == 0) {
return false;
}
/* Wait until no other thread is trying to steal a tile. */
- while (tile_stealing_state != NOT_STEALING && stealable_tiles > 0) {
+ while (tile_stealing_state_ != NOT_STEALING && stealable_tiles_ > 0) {
/* Someone else is currently trying to get a tile.
* Wait on the condition variable and try later. */
- tile_steal_cond.wait(tile_lock);
+ tile_steal_cond_.wait(tile_lock);
}
/* If another thread stole the last stealable tile in the meantime, give up. */
- if (stealable_tiles == 0) {
+ if (stealable_tiles_ == 0) {
return false;
}
/* There are stealable tiles in flight, so signal that one should be released. */
- tile_stealing_state = WAITING_FOR_TILE;
+ tile_stealing_state_ = WAITING_FOR_TILE;
/* Wait until a device notices the signal and releases its tile. */
- while (tile_stealing_state != GOT_TILE && stealable_tiles > 0) {
- tile_steal_cond.wait(tile_lock);
+ while (tile_stealing_state_ != GOT_TILE && stealable_tiles_ > 0) {
+ tile_steal_cond_.wait(tile_lock);
}
/* If the last stealable tile finished on its own, give up. */
- if (tile_stealing_state != GOT_TILE) {
- tile_stealing_state = NOT_STEALING;
+ if (tile_stealing_state_ != GOT_TILE) {
+ tile_stealing_state_ = NOT_STEALING;
return false;
}
/* Successfully stole a tile, now move it to the new device. */
- rtile = stolen_tile;
+ rtile = stolen_tile_;
rtile.buffers->buffer.move_device(tile_device);
rtile.buffer = rtile.buffers->buffer.device_pointer;
rtile.stealing_state = RenderTile::NO_STEALING;
rtile.num_samples -= (rtile.sample - rtile.start_sample);
rtile.start_sample = rtile.sample;
- tile_stealing_state = NOT_STEALING;
+ tile_stealing_state_ = NOT_STEALING;
/* Poke any threads which might be waiting for NOT_STEALING above. */
- tile_steal_cond.notify_one();
+ tile_steal_cond_.notify_one();
return true;
}
@@ -394,7 +394,7 @@ bool Session::get_tile_stolen()
/* If tile_stealing_state is WAITING_FOR_TILE, atomically set it to RELEASING_TILE
* and return true. */
TileStealingState expected = WAITING_FOR_TILE;
- return tile_stealing_state.compare_exchange_weak(ex
@@ Diff output truncated at 10240 characters. @@
More information about the Bf-blender-cvs
mailing list