Changeset View
Changeset View
Standalone View
Standalone View
intern/cycles/render/tile.h
| Show All 25 Lines | |||||
| /* Tile */ | /* Tile */ | ||||
| class Tile { | class Tile { | ||||
| public: | public: | ||||
| int index; | int index; | ||||
| int x, y, w, h; | int x, y, w, h; | ||||
| int device; | int device; | ||||
| /* RENDER: The tile has to be rendered. | |||||
| * RENDERED: The tile has been rendered, but can't be denoised yet (waiting for neighbors). | |||||
| * DENOISE: The tile can be denoised now. | |||||
| * DENOISED: The tile has been denoised, but can't be freed yet (waiting for neighbors). | |||||
| * DONE: The tile is finished and has been freed. */ | |||||
| typedef enum { RENDER = 0, RENDERED, DENOISE, DENOISED, DONE } TileState; | |||||
brecht: Would just name it `State` since it's already in the `Tile` namespace. | |||||
| TileState state; | |||||
| RenderBuffers *buffers; | |||||
| Tile() | Tile() | ||||
| {} | {} | ||||
| Tile(int index_, int x_, int y_, int w_, int h_, int device_) | Tile(int index_, int x_, int y_, int w_, int h_, int device_, TileState state_ = RENDER, RenderBuffers *buffers_ = NULL) | ||||
| : index(index_), x(x_), y(y_), w(w_), h(h_), device(device_) {} | : index(index_), x(x_), y(y_), w(w_), h(h_), device(device_), state(state_), buffers(buffers_) {} | ||||
| }; | }; | ||||
| /* Tile order */ | /* Tile order */ | ||||
| /* Note: this should match enum_tile_order in properties.py */ | /* Note: this should match enum_tile_order in properties.py */ | ||||
| enum TileOrder { | enum TileOrder { | ||||
| TILE_CENTER = 0, | TILE_CENTER = 0, | ||||
| TILE_RIGHT_TO_LEFT = 1, | TILE_RIGHT_TO_LEFT = 1, | ||||
| TILE_LEFT_TO_RIGHT = 2, | TILE_LEFT_TO_RIGHT = 2, | ||||
| 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: | public: | ||||
| BufferParams params; | BufferParams params; | ||||
| struct State { | struct State { | ||||
| vector<Tile> tiles; | |||||
| int tile_stride; | |||||
| BufferParams buffer; | BufferParams buffer; | ||||
| RenderBuffers *global_buffers; | |||||
Done Inline ActionsThis seems to serve no purpose, always set to NULL? brecht: This seems to serve no purpose, always set to `NULL`? | |||||
| 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; | ||||
| /* This vector contains a list of tiles for every logical device in the session. | |||||
| * In each list, the tiles are sorted according to the tile order setting. */ | /* These lists contain the indices of the tiles to be rendered/denoised and are used | ||||
| vector<list<Tile> > tiles; | * when acquiring a new tile for the device. | ||||
| * Each list in each vector is for one logical device. */ | |||||
| vector<list<int> > render_tiles; | |||||
| vector<list<int> > denoising_tiles; | |||||
| } state; | } state; | ||||
| int num_samples; | int num_samples; | ||||
| TileManager(bool progressive, int num_samples, int2 tile_size, int start_resolution, | TileManager(bool progressive, int num_samples, int2 tile_size, int start_resolution, | ||||
| bool preserve_tile_device, bool background, TileOrder tile_order, int num_devices = 1); | bool preserve_tile_device, bool background, TileOrder tile_order, int num_devices = 1); | ||||
| ~TileManager(); | ~TileManager(); | ||||
| void free_device(); | |||||
| void reset(BufferParams& params, int num_samples); | void reset(BufferParams& params, int num_samples); | ||||
| void set_samples(int num_samples); | void set_samples(int num_samples); | ||||
| bool next(); | bool next(); | ||||
| bool next_tile(Tile& tile, int device = 0); | bool next_tile(Tile* &tile, int device = 0); | ||||
| bool return_tile(int index, bool& delete_tile); | |||||
| bool done(); | bool done(); | ||||
| void set_tile_order(TileOrder tile_order_) { tile_order = tile_order_; } | void set_tile_order(TileOrder tile_order_) { tile_order = tile_order_; } | ||||
| /* ** Sample range rendering. ** */ | /* ** Sample range rendering. ** */ | ||||
| /* Start sample in the range. */ | /* Start sample in the range. */ | ||||
| int range_start_sample; | int range_start_sample; | ||||
| /* Number to samples in the rendering range. */ | /* Number to samples in the rendering range. */ | ||||
| int range_num_samples; | 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; | ||||
| Show All 29 Lines | |||||
Would just name it State since it's already in the Tile namespace.