diff options
Diffstat (limited to 'intern')
-rw-r--r-- | intern/cycles/blender/addon/properties.py | 10 | ||||
-rw-r--r-- | intern/cycles/blender/addon/ui.py | 2 | ||||
-rw-r--r-- | intern/cycles/blender/blender_sync.cpp | 4 | ||||
-rw-r--r-- | intern/cycles/render/session.cpp | 8 | ||||
-rw-r--r-- | intern/cycles/render/session.h | 6 | ||||
-rw-r--r-- | intern/cycles/render/tile.cpp | 30 | ||||
-rw-r--r-- | intern/cycles/render/tile.h | 8 |
7 files changed, 39 insertions, 29 deletions
diff --git a/intern/cycles/blender/addon/properties.py b/intern/cycles/blender/addon/properties.py index 7f3eca471e6..0fadfa0afc8 100644 --- a/intern/cycles/blender/addon/properties.py +++ b/intern/cycles/blender/addon/properties.py @@ -242,11 +242,11 @@ class CyclesRenderSettings(bpy.types.PropertyGroup): default=1024, ) - cls.resolution_divider = IntProperty( - name="Resolution Divider", - description="For viewport render, the number of lower resolutions to render before the full resolution", - min=1, max=512, - default=4, + cls.preview_start_resolution = IntProperty( + name="Start Resolution", + description="Resolution to start rendering preview at, progressively increasing it to the full viewport size", + min=8, max=16384, + default=64, ) cls.debug_reset_timeout = FloatProperty( diff --git a/intern/cycles/blender/addon/ui.py b/intern/cycles/blender/addon/ui.py index 7486edf2319..1aef36e0988 100644 --- a/intern/cycles/blender/addon/ui.py +++ b/intern/cycles/blender/addon/ui.py @@ -216,7 +216,7 @@ class CyclesRender_PT_performance(CyclesButtonsPanel, Panel): sub = col.column(align=True) sub.label(text="Viewport:") - sub.prop(cscene, "resolution_divider") + sub.prop(cscene, "preview_start_resolution") class CyclesRender_PT_layers(CyclesButtonsPanel, Panel): diff --git a/intern/cycles/blender/blender_sync.cpp b/intern/cycles/blender/blender_sync.cpp index 907573cf072..b4990eb815a 100644 --- a/intern/cycles/blender/blender_sync.cpp +++ b/intern/cycles/blender/blender_sync.cpp @@ -368,7 +368,7 @@ SessionParams BlenderSync::get_session_params(BL::RenderEngine b_engine, BL::Use params.tile_size = make_int2(tile_x, tile_y); } - params.resolution = 1 << get_int(cscene, "resolution_divider"); + params.start_resolution = get_int(cscene, "preview_start_resolution"); /* other parameters */ params.threads = b_scene.render().threads(); @@ -379,7 +379,7 @@ SessionParams BlenderSync::get_session_params(BL::RenderEngine b_engine, BL::Use if(background) { params.progressive = false; - params.resolution = 1; + params.start_resolution = INT_MAX; } else params.progressive = true; diff --git a/intern/cycles/render/session.cpp b/intern/cycles/render/session.cpp index 05c57ba48ec..b190cdfec96 100644 --- a/intern/cycles/render/session.cpp +++ b/intern/cycles/render/session.cpp @@ -36,7 +36,7 @@ CCL_NAMESPACE_BEGIN Session::Session(const SessionParams& params_) : params(params_), - tile_manager(params.progressive, params.samples, params.tile_size, params.resolution, + tile_manager(params.progressive, params.samples, params.tile_size, params.start_resolution, (params.background)? 1: max(params.device.multi_devices.size(), 1)) { device_use_gl = ((params.device.type != DEVICE_CPU) && !params.background); @@ -343,7 +343,7 @@ bool Session::acquire_tile(Device *tile_device, RenderTile& rtile) rtile.h = tile.h; rtile.start_sample = tile_manager.state.sample; rtile.num_samples = tile_manager.state.num_samples; - rtile.resolution = tile_manager.state.resolution; + rtile.resolution = tile_manager.state.resolution_divider; tile_lock.unlock(); @@ -668,7 +668,7 @@ void Session::update_scene() void Session::update_status_time(bool show_pause, bool show_done) { int sample = tile_manager.state.sample; - int resolution = tile_manager.state.resolution; + int resolution = tile_manager.state.resolution_divider; int num_tiles = tile_manager.state.num_tiles; int tile = tile_manager.state.num_rendered_tiles; @@ -757,7 +757,7 @@ void Session::tonemap() task.rgba = display->rgba.device_pointer; task.buffer = buffers->buffer.device_pointer; task.sample = tile_manager.state.sample; - task.resolution = tile_manager.state.resolution; + task.resolution = tile_manager.state.resolution_divider; tile_manager.state.buffer.get_offset_stride(task.offset, task.stride); if(task.w > 0 && task.h > 0) { diff --git a/intern/cycles/render/session.h b/intern/cycles/render/session.h index e45753d22a0..a3a2751fb23 100644 --- a/intern/cycles/render/session.h +++ b/intern/cycles/render/session.h @@ -48,7 +48,7 @@ public: bool experimental; int samples; int2 tile_size; - int resolution; + int start_resolution; int threads; double cancel_timeout; @@ -64,7 +64,7 @@ public: experimental = false; samples = INT_MAX; tile_size = make_int2(64, 64); - resolution = 4; + start_resolution = INT_MAX; threads = 0; cancel_timeout = 0.1; @@ -81,7 +81,7 @@ public: && progressive == params.progressive && experimental == params.experimental && tile_size == params.tile_size - && resolution == params.resolution + && start_resolution == params.start_resolution && threads == params.threads && cancel_timeout == params.cancel_timeout && reset_timeout == params.reset_timeout diff --git a/intern/cycles/render/tile.cpp b/intern/cycles/render/tile.cpp index b4156fd9471..874f1a6b3aa 100644 --- a/intern/cycles/render/tile.cpp +++ b/intern/cycles/render/tile.cpp @@ -23,11 +23,11 @@ CCL_NAMESPACE_BEGIN -TileManager::TileManager(bool progressive_, int num_samples_, int2 tile_size_, int resolution_, int num_devices_) +TileManager::TileManager(bool progressive_, int num_samples_, int2 tile_size_, int start_resolution_, int num_devices_) { progressive = progressive_; tile_size = tile_size_; - resolution = resolution_; + start_resolution = start_resolution_; num_devices = num_devices_; BufferParams buffer_params; @@ -42,6 +42,18 @@ void TileManager::reset(BufferParams& params_, int num_samples_) { params = params_; + int divider = 1; + int w = params.width, h = params.height; + + if(start_resolution != INT_MAX) { + while(w*h > start_resolution*start_resolution) { + w = max(1, w/2); + h = max(1, h/2); + + divider *= 2; + } + } + num_samples = num_samples_; state.buffer = BufferParams(); @@ -49,7 +61,7 @@ void TileManager::reset(BufferParams& params_, int num_samples_) state.num_tiles = 0; state.num_rendered_tiles = 0; state.num_samples = 0; - state.resolution = resolution; + state.resolution_divider = divider; state.tiles.clear(); } @@ -60,7 +72,7 @@ void TileManager::set_samples(int num_samples_) void TileManager::set_tiles() { - int resolution = state.resolution; + int resolution = state.resolution_divider; int image_w = max(1, params.width/resolution); int image_h = max(1, params.height/resolution); @@ -104,7 +116,7 @@ list<Tile>::iterator TileManager::next_center_tile(int device) { list<Tile>::iterator iter, best = state.tiles.end(); - int resolution = state.resolution; + int resolution = state.resolution_divider; int image_w = max(1, params.width/resolution); int image_h = max(1, params.height/resolution); @@ -167,7 +179,7 @@ bool TileManager::next_tile(Tile& tile, int device) bool TileManager::done() { - return (state.sample+state.num_samples >= num_samples && state.resolution == 1); + return (state.sample+state.num_samples >= num_samples && state.resolution_divider == 1); } bool TileManager::next() @@ -175,9 +187,9 @@ bool TileManager::next() if(done()) return false; - if(progressive && state.resolution > 1) { + if(progressive && state.resolution_divider > 1) { state.sample = 0; - state.resolution /= 2; + state.resolution_divider /= 2; state.num_samples = 1; set_tiles(); } @@ -189,7 +201,7 @@ bool TileManager::next() else state.num_samples = num_samples; - state.resolution = 1; + state.resolution_divider = 1; set_tiles(); } diff --git a/intern/cycles/render/tile.h b/intern/cycles/render/tile.h index 29f2b1ef9f9..d820f74e3bd 100644 --- a/intern/cycles/render/tile.h +++ b/intern/cycles/render/tile.h @@ -51,13 +51,13 @@ public: BufferParams buffer; int sample; int num_samples; - int resolution; + int resolution_divider; int num_tiles; int num_rendered_tiles; list<Tile> tiles; } state; - TileManager(bool progressive, int num_samples, int2 tile_size, int resolution, int num_devices = 1); + TileManager(bool progressive, int num_samples, int2 tile_size, int start_resolution, int num_devices = 1); ~TileManager(); void reset(BufferParams& params, int num_samples); @@ -72,10 +72,8 @@ protected: bool progressive; int num_samples; int2 tile_size; - int resolution; - int num_devices; - int start_resolution; + int num_devices; list<Tile>::iterator next_center_tile(int device = 0); }; |