Cycles: some small code refactoring related to buffer parameters.
This commit is contained in:
@@ -56,6 +56,12 @@ public:
|
||||
full_height = 0;
|
||||
}
|
||||
|
||||
void get_offset_stride(int& offset, int& stride)
|
||||
{
|
||||
offset = -(full_x + full_y*width);
|
||||
stride = width;
|
||||
}
|
||||
|
||||
bool modified(const BufferParams& params)
|
||||
{
|
||||
return !(full_x == params.full_x
|
||||
|
@@ -515,10 +515,8 @@ void Session::update_scene()
|
||||
knows nothing about progressive or cropped rendering, it just gets the
|
||||
image dimensions passed in */
|
||||
Camera *cam = scene->camera;
|
||||
float progressive_x = tile_manager.state.width/(float)tile_manager.params.width;
|
||||
float progressive_y = tile_manager.state.height/(float)tile_manager.params.height;
|
||||
int width = tile_manager.params.full_width*progressive_x;
|
||||
int height = tile_manager.params.full_height*progressive_y;
|
||||
int width = tile_manager.state.buffer.full_width;
|
||||
int height = tile_manager.state.buffer.full_height;
|
||||
|
||||
if(width != cam->width || height != cam->height) {
|
||||
cam->width = width;
|
||||
@@ -574,16 +572,15 @@ void Session::path_trace(Tile& tile)
|
||||
/* add path trace task */
|
||||
DeviceTask task(DeviceTask::PATH_TRACE);
|
||||
|
||||
task.x = tile_manager.state.full_x + tile.x;
|
||||
task.y = tile_manager.state.full_y + tile.y;
|
||||
task.x = tile_manager.state.buffer.full_x + tile.x;
|
||||
task.y = tile_manager.state.buffer.full_y + tile.y;
|
||||
task.w = tile.w;
|
||||
task.h = tile.h;
|
||||
task.buffer = buffers->buffer.device_pointer;
|
||||
task.rng_state = buffers->rng_state.device_pointer;
|
||||
task.sample = tile_manager.state.sample;
|
||||
task.resolution = tile_manager.state.resolution;
|
||||
task.offset = -(tile_manager.state.full_x + tile_manager.state.full_y*tile_manager.state.width);
|
||||
task.stride = tile_manager.state.width;
|
||||
tile_manager.state.buffer.get_offset_stride(task.offset, task.stride);
|
||||
|
||||
device->task_add(task);
|
||||
}
|
||||
@@ -593,16 +590,15 @@ void Session::tonemap()
|
||||
/* add tonemap task */
|
||||
DeviceTask task(DeviceTask::TONEMAP);
|
||||
|
||||
task.x = tile_manager.state.full_x;
|
||||
task.y = tile_manager.state.full_y;
|
||||
task.w = tile_manager.state.width;
|
||||
task.h = tile_manager.state.height;
|
||||
task.x = tile_manager.state.buffer.full_x;
|
||||
task.y = tile_manager.state.buffer.full_y;
|
||||
task.w = tile_manager.state.buffer.width;
|
||||
task.h = tile_manager.state.buffer.height;
|
||||
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.offset = -(tile_manager.state.full_x + tile_manager.state.full_y*tile_manager.state.width);
|
||||
task.stride = tile_manager.state.width;
|
||||
tile_manager.state.buffer.get_offset_stride(task.offset, task.stride);
|
||||
|
||||
if(task.w > 0 && task.h > 0) {
|
||||
device->task_add(task);
|
||||
|
@@ -55,10 +55,7 @@ void TileManager::reset(BufferParams& params_, int samples_)
|
||||
|
||||
samples = samples_;
|
||||
|
||||
state.full_x = 0;
|
||||
state.full_y = 0;
|
||||
state.width = 0;
|
||||
state.height = 0;
|
||||
state.buffer = BufferParams();
|
||||
state.sample = -1;
|
||||
state.resolution = start_resolution;
|
||||
state.tiles.clear();
|
||||
@@ -92,10 +89,13 @@ void TileManager::set_tiles()
|
||||
}
|
||||
}
|
||||
|
||||
state.full_x = params.full_x/resolution;
|
||||
state.full_y = params.full_y/resolution;
|
||||
state.width = image_w;
|
||||
state.height = image_h;
|
||||
state.buffer.width = image_w;
|
||||
state.buffer.height = image_h;
|
||||
|
||||
state.buffer.full_x = params.full_x/resolution;
|
||||
state.buffer.full_y = params.full_y/resolution;
|
||||
state.buffer.full_width = max(1, params.full_width/resolution);
|
||||
state.buffer.full_height = max(1, params.full_height/resolution);
|
||||
}
|
||||
|
||||
bool TileManager::done()
|
||||
|
@@ -41,11 +41,9 @@ public:
|
||||
class TileManager {
|
||||
public:
|
||||
BufferParams params;
|
||||
|
||||
struct State {
|
||||
int full_x;
|
||||
int full_y;
|
||||
int width;
|
||||
int height;
|
||||
BufferParams buffer;
|
||||
int sample;
|
||||
int resolution;
|
||||
list<Tile> tiles;
|
||||
|
Reference in New Issue
Block a user