Changeset View
Changeset View
Standalone View
Standalone View
intern/cycles/render/tile.h
| Show All 14 Lines | |||||
| */ | */ | ||||
| #ifndef __TILE_H__ | #ifndef __TILE_H__ | ||||
| #define __TILE_H__ | #define __TILE_H__ | ||||
| #include <limits.h> | #include <limits.h> | ||||
| #include "render/buffers.h" | #include "render/buffers.h" | ||||
| #include "util/util_api.h" | |||||
| #include "util/util_list.h" | #include "util/util_list.h" | ||||
| CCL_NAMESPACE_BEGIN | CCL_NAMESPACE_BEGIN | ||||
| /* Tile */ | /* Tile */ | ||||
| class Tile { | class Tile { | ||||
| public: | public: | ||||
| Show All 29 Lines | enum TileOrder { | ||||
| TILE_TOP_TO_BOTTOM = 3, | TILE_TOP_TO_BOTTOM = 3, | ||||
| TILE_BOTTOM_TO_TOP = 4, | TILE_BOTTOM_TO_TOP = 4, | ||||
| TILE_HILBERT_SPIRAL = 5, | TILE_HILBERT_SPIRAL = 5, | ||||
| }; | }; | ||||
| /* Tile Manager */ | /* Tile Manager */ | ||||
| class TileManager { | class TileManager { | ||||
| public: | private: | ||||
| BufferParams params; | GET(BufferParams, params) | ||||
| struct State { | struct State { | ||||
| vector<Tile> tiles; | vector<Tile> tiles; | ||||
| int tile_stride; | int tile_stride; | ||||
| BufferParams buffer; | BufferParams buffer; | ||||
| int sample; | int sample; | ||||
| int num_samples; | int num_samples; | ||||
| int resolution_divider; | int resolution_divider; | ||||
| int num_tiles; | int num_tiles; | ||||
| /* Total samples over all pixels: Generally num_samples*num_pixels, | /* Total samples over all pixels: Generally num_samples*num_pixels, | ||||
| * but can be higher due to the initial resolution division for previews. */ | * but can be higher due to the initial resolution division for previews. */ | ||||
| uint64_t total_pixel_samples; | uint64_t total_pixel_samples; | ||||
| /* These lists contain the indices of the tiles to be rendered/denoised and are used | /* These lists contain the indices of the tiles to be rendered/denoised and are used | ||||
| * when acquiring a new tile for the device. | * when acquiring a new tile for the device. | ||||
| * Each list in each vector is for one logical device. */ | * Each list in each vector is for one logical device. */ | ||||
| vector<list<int>> render_tiles; | vector<list<int>> render_tiles; | ||||
| vector<list<int>> denoising_tiles; | vector<list<int>> denoising_tiles; | ||||
| } state; | } state; | ||||
| int num_samples; | int num_samples; | ||||
| int slice_overlap; | int slice_overlap; | ||||
| /* ** Sample range rendering. ** */ | |||||
| /* Start sample in the range. */ | |||||
| GET_SET(int, range_start_sample) | |||||
| /* Number to samples in the rendering range. */ | |||||
| GET_SET(int, range_num_samples) | |||||
| /* Schedule tiles for denoising after they've been rendered. */ | |||||
| bool schedule_denoising; | |||||
| friend class Session; | |||||
| public: | |||||
| TileManager(bool progressive, | TileManager(bool progressive, | ||||
| int num_samples, | int num_samples, | ||||
| int2 tile_size, | int2 tile_size, | ||||
| int start_resolution, | int start_resolution, | ||||
| bool preserve_tile_device, | bool preserve_tile_device, | ||||
| bool background, | bool background, | ||||
| TileOrder tile_order, | TileOrder tile_order, | ||||
| int num_devices = 1, | int num_devices = 1, | ||||
| Show All 12 Lines | public: | ||||
| void set_tile_order(TileOrder tile_order_) | void set_tile_order(TileOrder tile_order_) | ||||
| { | { | ||||
| tile_order = tile_order_; | tile_order = tile_order_; | ||||
| } | } | ||||
| int get_neighbor_index(int index, int neighbor); | int get_neighbor_index(int index, int neighbor); | ||||
| bool check_neighbor_state(int index, Tile::State state); | bool check_neighbor_state(int index, Tile::State state); | ||||
| /* ** Sample range rendering. ** */ | |||||
| /* Start sample in the range. */ | |||||
| int range_start_sample; | |||||
| /* Number to samples in the rendering range. */ | |||||
| int range_num_samples; | |||||
| /* Get number of actual samples to render. */ | /* Get number of actual samples to render. */ | ||||
| int get_num_effective_samples(); | int get_num_effective_samples(); | ||||
| /* Schedule tiles for denoising after they've been rendered. */ | |||||
| bool schedule_denoising; | |||||
| protected: | protected: | ||||
| void set_tiles(); | void set_tiles(); | ||||
| bool progressive; | bool progressive; | ||||
| int2 tile_size; | int2 tile_size; | ||||
| TileOrder tile_order; | TileOrder tile_order; | ||||
| int start_resolution; | int start_resolution; | ||||
| int pixel_size; | int pixel_size; | ||||
| Show All 29 Lines | |||||