Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBrecht Van Lommel <brecht>2021-09-30 17:51:03 +0300
committerBrecht Van Lommel <brecht@blender.org>2021-09-30 21:53:27 +0300
commit1a134c4c30a643ada1b9a7a037040b5f5c173a28 (patch)
treeb4216998527ff24fb3fc9e9351ced05cd7b7eb08 /intern/cycles/integrator/path_trace.cpp
parenta754e35198d852ea34e2b82cd2b126538e6f5a3b (diff)
Cycles: refactor API for render output
* Add OutputDriver, replacing function callbacks in Session. * Add PathTraceTile, replacing tile access methods in Session. * Add more detailed comments about how this driver should be implemented. * Add OIIOOutputDriver for Cycles standalone to output an image. Differential Revision: https://developer.blender.org/D12627
Diffstat (limited to 'intern/cycles/integrator/path_trace.cpp')
-rw-r--r--intern/cycles/integrator/path_trace.cpp32
1 files changed, 25 insertions, 7 deletions
diff --git a/intern/cycles/integrator/path_trace.cpp b/intern/cycles/integrator/path_trace.cpp
index 36cd7314b4c..7624b244175 100644
--- a/intern/cycles/integrator/path_trace.cpp
+++ b/intern/cycles/integrator/path_trace.cpp
@@ -20,6 +20,7 @@
#include "device/device.h"
#include "integrator/pass_accessor.h"
#include "integrator/path_trace_display.h"
+#include "integrator/path_trace_tile.h"
#include "integrator/render_scheduler.h"
#include "render/pass.h"
#include "render/scene.h"
@@ -535,6 +536,11 @@ void PathTrace::denoise(const RenderWork &render_work)
render_scheduler_.report_denoise_time(render_work, time_dt() - start_time);
}
+void PathTrace::set_output_driver(unique_ptr<OutputDriver> driver)
+{
+ output_driver_ = move(driver);
+}
+
void PathTrace::set_display_driver(unique_ptr<DisplayDriver> driver)
{
if (driver) {
@@ -567,7 +573,7 @@ void PathTrace::update_display(const RenderWork &render_work)
return;
}
- if (!display_ && !tile_buffer_update_cb) {
+ if (!display_ && !output_driver_) {
VLOG(3) << "Ignore display update.";
return;
}
@@ -579,10 +585,11 @@ void PathTrace::update_display(const RenderWork &render_work)
const double start_time = time_dt();
- if (tile_buffer_update_cb) {
+ if (output_driver_) {
VLOG(3) << "Invoke buffer update callback.";
- tile_buffer_update_cb();
+ PathTraceTile tile(*this);
+ output_driver_->update_render_tile(tile);
}
if (display_) {
@@ -758,20 +765,26 @@ bool PathTrace::is_cancel_requested()
void PathTrace::tile_buffer_write()
{
- if (!tile_buffer_write_cb) {
+ if (!output_driver_) {
return;
}
- tile_buffer_write_cb();
+ PathTraceTile tile(*this);
+ output_driver_->write_render_tile(tile);
}
void PathTrace::tile_buffer_read()
{
- if (!tile_buffer_read_cb) {
+ if (!device_scene_->data.bake.use) {
return;
}
- if (tile_buffer_read_cb()) {
+ if (!output_driver_) {
+ return;
+ }
+
+ PathTraceTile tile(*this);
+ if (output_driver_->read_render_tile(tile)) {
tbb::parallel_for_each(path_trace_works_, [](unique_ptr<PathTraceWork> &path_trace_work) {
path_trace_work->copy_render_buffers_to_device();
});
@@ -1010,6 +1023,11 @@ int2 PathTrace::get_render_tile_offset() const
return make_int2(tile.x, tile.y);
}
+int2 PathTrace::get_render_size() const
+{
+ return tile_manager_.get_size();
+}
+
const BufferParams &PathTrace::get_render_tile_params() const
{
if (full_frame_state_.render_buffers) {