Blender  V2.93
tile.cpp
Go to the documentation of this file.
1 /*
2  * Copyright 2011-2013 Blender Foundation
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
17 #include "render/tile.h"
18 
19 #include "util/util_algorithm.h"
20 #include "util/util_foreach.h"
21 #include "util/util_types.h"
22 
24 
25 namespace {
26 
28  public:
29  TileComparator(TileOrder order_, int2 center_, Tile *tiles_)
30  : order(order_), center(center_), tiles(tiles_)
31  {
32  }
33 
34  bool operator()(int a, int b)
35  {
36  switch (order) {
37  case TILE_CENTER: {
38  float2 dist_a = make_float2(center.x - (tiles[a].x + tiles[a].w / 2),
39  center.y - (tiles[a].y + tiles[a].h / 2));
40  float2 dist_b = make_float2(center.x - (tiles[b].x + tiles[b].w / 2),
41  center.y - (tiles[b].y + tiles[b].h / 2));
42  return dot(dist_a, dist_a) < dot(dist_b, dist_b);
43  }
44  case TILE_LEFT_TO_RIGHT:
45  return (tiles[a].x == tiles[b].x) ? (tiles[a].y < tiles[b].y) : (tiles[a].x < tiles[b].x);
46  case TILE_RIGHT_TO_LEFT:
47  return (tiles[a].x == tiles[b].x) ? (tiles[a].y < tiles[b].y) : (tiles[a].x > tiles[b].x);
48  case TILE_TOP_TO_BOTTOM:
49  return (tiles[a].y == tiles[b].y) ? (tiles[a].x < tiles[b].x) : (tiles[a].y > tiles[b].y);
50  case TILE_BOTTOM_TO_TOP:
51  default:
52  return (tiles[a].y == tiles[b].y) ? (tiles[a].x < tiles[b].x) : (tiles[a].y < tiles[b].y);
53  }
54  }
55 
56  protected:
60 };
61 
62 inline int2 hilbert_index_to_pos(int n, int d)
63 {
64  int2 r, xy = make_int2(0, 0);
65  for (int s = 1; s < n; s *= 2) {
66  r.x = (d >> 1) & 1;
67  r.y = (d ^ r.x) & 1;
68  if (!r.y) {
69  if (r.x) {
70  xy = make_int2(s - 1, s - 1) - xy;
71  }
72  swap(xy.x, xy.y);
73  }
74  xy += r * make_int2(s, s);
75  d >>= 2;
76  }
77  return xy;
78 }
79 
85 };
86 
87 } /* namespace */
88 
89 TileManager::TileManager(bool progressive_,
90  int num_samples_,
91  int2 tile_size_,
92  int start_resolution_,
93  bool preserve_tile_device_,
94  bool background_,
95  TileOrder tile_order_,
96  int num_devices_,
97  int pixel_size_)
98 {
99  progressive = progressive_;
100  tile_size = tile_size_;
101  tile_order = tile_order_;
102  start_resolution = start_resolution_;
103  pixel_size = pixel_size_;
104  slice_overlap = 0;
105  num_samples = num_samples_;
106  num_devices = num_devices_;
107  preserve_tile_device = preserve_tile_device_;
108  background = background_;
109  schedule_denoising = false;
110 
111  range_start_sample = 0;
112  range_num_samples = -1;
113 
114  BufferParams buffer_params;
115  reset(buffer_params, 0);
116 }
117 
119 {
120 }
121 
123 {
125  for (int i = 0; i < state.tiles.size(); i++) {
126  delete state.tiles[i].buffers;
127  state.tiles[i].buffers = NULL;
128  }
129  }
130 
131  state.tiles.clear();
132 }
133 
134 static int get_divider(int w, int h, int start_resolution)
135 {
136  int divider = 1;
137  if (start_resolution != INT_MAX) {
138  while (w * h > start_resolution * start_resolution) {
139  w = max(1, w / 2);
140  h = max(1, h / 2);
141 
142  divider <<= 1;
143  }
144  }
145  return divider;
146 }
147 
148 void TileManager::reset(BufferParams &params_, int num_samples_)
149 {
150  params = params_;
151 
152  set_samples(num_samples_);
153 
156  state.num_tiles = 0;
157  state.num_samples = 0;
159  state.render_tiles.clear();
160  state.denoising_tiles.clear();
161  device_free();
162 }
163 
164 void TileManager::set_samples(int num_samples_)
165 {
166  num_samples = num_samples_;
167 
168  /* No real progress indication is possible when using unlimited samples. */
169  if (num_samples == INT_MAX) {
171  }
172  else {
173  uint64_t pixel_samples = 0;
174  /* While rendering in the viewport, the initial preview resolution is increased to the native
175  * resolution before the actual rendering begins. Therefore, additional pixel samples will be
176  * rendered. */
178  while (divider > pixel_size) {
179  int image_w = max(1, params.width / divider);
180  int image_h = max(1, params.height / divider);
181  pixel_samples += image_w * image_h;
182  divider >>= 1;
183  }
184 
185  int image_w = max(1, params.width / divider);
186  int image_h = max(1, params.height / divider);
187  state.total_pixel_samples = pixel_samples +
188  (uint64_t)get_num_effective_samples() * image_w * image_h;
189  if (schedule_denoising) {
191  }
192  }
193 }
194 
195 /* If sliced is false, splits image into tiles and assigns equal amount of tiles to every render
196  * device. If sliced is true, slice image into as much pieces as how many devices are rendering
197  * this image. */
198 int TileManager::gen_tiles(bool sliced)
199 {
200  int resolution = state.resolution_divider;
201  int image_w = max(1, params.width / resolution);
202  int image_h = max(1, params.height / resolution);
203  int2 center = make_int2(image_w / 2, image_h / 2);
204 
205  int num = preserve_tile_device || sliced ? min(image_h, num_devices) : 1;
206  int slice_num = sliced ? num : 1;
207  int tile_w = (tile_size.x >= image_w) ? 1 : divide_up(image_w, tile_size.x);
208 
209  device_free();
210  state.render_tiles.clear();
211  state.denoising_tiles.clear();
212  state.render_tiles.resize(num);
213  state.denoising_tiles.resize(num);
214  state.tile_stride = tile_w;
215  vector<list<int>>::iterator tile_list;
216  tile_list = state.render_tiles.begin();
217 
219  assert(!sliced && slice_overlap == 0);
220 
221  int tile_h = (tile_size.y >= image_h) ? 1 : divide_up(image_h, tile_size.y);
222  state.tiles.resize(tile_w * tile_h);
223 
224  /* Size of blocks in tiles, must be a power of 2 */
225  const int hilbert_size = (max(tile_size.x, tile_size.y) <= 12) ? 8 : 4;
226 
227  int tiles_per_device = divide_up(tile_w * tile_h, num);
228  int cur_device = 0, cur_tiles = 0;
229 
230  int2 block_size = tile_size * make_int2(hilbert_size, hilbert_size);
231  /* Number of blocks to fill the image */
232  int blocks_x = (block_size.x >= image_w) ? 1 : divide_up(image_w, block_size.x);
233  int blocks_y = (block_size.y >= image_h) ? 1 : divide_up(image_h, block_size.y);
234  int n = max(blocks_x, blocks_y) | 0x1; /* Side length of the spiral (must be odd) */
235  /* Offset of spiral (to keep it centered) */
236  int2 offset = make_int2((image_w - n * block_size.x) / 2, (image_h - n * block_size.y) / 2);
237  offset = (offset / tile_size) * tile_size; /* Round to tile border. */
238 
239  int2 block = make_int2(0, 0); /* Current block */
240  SpiralDirection prev_dir = DIRECTION_UP, dir = DIRECTION_UP;
241  for (int i = 0;;) {
242  /* Generate the tiles in the current block. */
243  for (int hilbert_index = 0; hilbert_index < hilbert_size * hilbert_size; hilbert_index++) {
244  int2 tile, hilbert_pos = hilbert_index_to_pos(hilbert_size, hilbert_index);
245  /* Rotate block according to spiral direction. */
246  if (prev_dir == DIRECTION_UP && dir == DIRECTION_UP) {
247  tile = make_int2(hilbert_pos.y, hilbert_pos.x);
248  }
249  else if (dir == DIRECTION_LEFT || prev_dir == DIRECTION_LEFT) {
250  tile = hilbert_pos;
251  }
252  else if (dir == DIRECTION_DOWN) {
253  tile = make_int2(hilbert_size - 1 - hilbert_pos.y, hilbert_size - 1 - hilbert_pos.x);
254  }
255  else {
256  tile = make_int2(hilbert_size - 1 - hilbert_pos.x, hilbert_size - 1 - hilbert_pos.y);
257  }
258 
259  int2 pos = block * block_size + tile * tile_size + offset;
260  /* Only add tiles which are in the image (tiles outside of the image can be generated since
261  * the spiral is always square). */
262  if (pos.x >= 0 && pos.y >= 0 && pos.x < image_w && pos.y < image_h) {
263  int w = min(tile_size.x, image_w - pos.x);
264  int h = min(tile_size.y, image_h - pos.y);
265  int2 ipos = pos / tile_size;
266  int idx = ipos.y * tile_w + ipos.x;
267  state.tiles[idx] = Tile(idx, pos.x, pos.y, w, h, cur_device, Tile::RENDER);
268  tile_list->push_front(idx);
269  cur_tiles++;
270 
271  if (cur_tiles == tiles_per_device) {
272  tile_list++;
273  cur_tiles = 0;
274  cur_device++;
275  }
276  }
277  }
278 
279  /* Stop as soon as the spiral has reached the center block. */
280  if (block.x == (n - 1) / 2 && block.y == (n - 1) / 2)
281  break;
282 
283  /* Advance to next block. */
284  prev_dir = dir;
285  switch (dir) {
286  case DIRECTION_UP:
287  block.y++;
288  if (block.y == (n - i - 1)) {
289  dir = DIRECTION_LEFT;
290  }
291  break;
292  case DIRECTION_LEFT:
293  block.x++;
294  if (block.x == (n - i - 1)) {
295  dir = DIRECTION_DOWN;
296  }
297  break;
298  case DIRECTION_DOWN:
299  block.y--;
300  if (block.y == i) {
301  dir = DIRECTION_RIGHT;
302  }
303  break;
304  case DIRECTION_RIGHT:
305  block.x--;
306  if (block.x == i + 1) {
307  dir = DIRECTION_UP;
308  i++;
309  }
310  break;
311  }
312  }
313  return tile_w * tile_h;
314  }
315 
316  int idx = 0;
317  for (int slice = 0; slice < slice_num; slice++) {
318  int slice_y = (image_h / slice_num) * slice;
319  int slice_h = (slice == slice_num - 1) ? image_h - slice * (image_h / slice_num) :
320  image_h / slice_num;
321 
322  if (slice_overlap != 0) {
323  int slice_y_offset = max(slice_y - slice_overlap, 0);
324  slice_h = min(slice_y + slice_h + slice_overlap, image_h) - slice_y_offset;
325  slice_y = slice_y_offset;
326  }
327 
328  int tile_h = (tile_size.y >= slice_h) ? 1 : divide_up(slice_h, tile_size.y);
329 
330  int tiles_per_device = divide_up(tile_w * tile_h, num);
331  int cur_device = 0, cur_tiles = 0;
332 
333  for (int tile_y = 0; tile_y < tile_h; tile_y++) {
334  for (int tile_x = 0; tile_x < tile_w; tile_x++, idx++) {
335  int x = tile_x * tile_size.x;
336  int y = tile_y * tile_size.y;
337  int w = (tile_x == tile_w - 1) ? image_w - x : tile_size.x;
338  int h = (tile_y == tile_h - 1) ? slice_h - y : tile_size.y;
339 
340  state.tiles.push_back(
341  Tile(idx, x, y + slice_y, w, h, sliced ? slice : cur_device, Tile::RENDER));
342  tile_list->push_back(idx);
343 
344  if (!sliced) {
345  cur_tiles++;
346 
347  if (cur_tiles == tiles_per_device) {
348  /* Tiles are already generated in Bottom-to-Top order, so no sort is necessary in that
349  * case. */
351  tile_list->sort(TileComparator(tile_order, center, &state.tiles[0]));
352  }
353  tile_list++;
354  cur_tiles = 0;
355  cur_device++;
356  }
357  }
358  }
359  }
360  if (sliced) {
361  tile_list++;
362  }
363  }
364 
365  return idx;
366 }
367 
369 {
370  /* Regenerate just the render tiles for progressive render. */
371  foreach (Tile &tile, state.tiles) {
372  tile.state = Tile::RENDER;
373  state.render_tiles[tile.device].push_back(tile.index);
374  }
375 }
376 
378 {
379  int resolution = state.resolution_divider;
380  int image_w = max(1, params.width / resolution);
381  int image_h = max(1, params.height / resolution);
382 
384 
385  state.buffer.width = image_w;
386  state.buffer.height = image_h;
387 
388  state.buffer.full_x = params.full_x / resolution;
389  state.buffer.full_y = params.full_y / resolution;
390  state.buffer.full_width = max(1, params.full_width / resolution);
391  state.buffer.full_height = max(1, params.full_height / resolution);
392 }
393 
394 int TileManager::get_neighbor_index(int index, int neighbor)
395 {
396  /* Neighbor indices:
397  * 0 1 2
398  * 3 4 5
399  * 6 7 8
400  */
401  static const int dx[] = {-1, 0, 1, -1, 0, 1, -1, 0, 1};
402  static const int dy[] = {-1, -1, -1, 0, 0, 0, 1, 1, 1};
403 
404  int resolution = state.resolution_divider;
405  int image_w = max(1, params.width / resolution);
406  int image_h = max(1, params.height / resolution);
407 
408  int num = min(image_h, num_devices);
409  int slice_num = !background ? num : 1;
410  int slice_h = image_h / slice_num;
411 
412  int tile_w = (tile_size.x >= image_w) ? 1 : divide_up(image_w, tile_size.x);
413  int tile_h = (tile_size.y >= slice_h) ? 1 : divide_up(slice_h, tile_size.y);
414 
415  /* Tiles in the state tile list are always indexed from left to right, top to bottom. */
416  int nx = (index % tile_w) + dx[neighbor];
417  int ny = (index / tile_w) + dy[neighbor];
418  if (nx < 0 || ny < 0 || nx >= tile_w || ny >= tile_h * slice_num)
419  return -1;
420 
421  return ny * state.tile_stride + nx;
422 }
423 
424 /* Checks whether all neighbors of a tile (as well as the tile itself) are at least at state
425  * min_state. */
427 {
428  if (index < 0 || state.tiles[index].state < min_state) {
429  return false;
430  }
431  for (int neighbor = 0; neighbor < 9; neighbor++) {
432  int nindex = get_neighbor_index(index, neighbor);
433  /* Out-of-bounds tiles don't matter. */
434  if (nindex >= 0 && state.tiles[nindex].state < min_state) {
435  return false;
436  }
437  }
438 
439  return true;
440 }
441 
442 /* Returns whether the tile should be written (and freed if no denoising is used) instead of
443  * updating. */
444 bool TileManager::finish_tile(const int index, const bool need_denoise, bool &delete_tile)
445 {
446  delete_tile = false;
447 
448  switch (state.tiles[index].state) {
449  case Tile::RENDER: {
450  if (!(schedule_denoising && need_denoise)) {
451  state.tiles[index].state = Tile::DONE;
452  delete_tile = !progressive;
453  return true;
454  }
455  state.tiles[index].state = Tile::RENDERED;
456  /* For each neighbor and the tile itself, check whether all of its neighbors have been
457  * rendered. If yes, it can be denoised. */
458  for (int neighbor = 0; neighbor < 9; neighbor++) {
459  int nindex = get_neighbor_index(index, neighbor);
460  if (check_neighbor_state(nindex, Tile::RENDERED)) {
461  state.tiles[nindex].state = Tile::DENOISE;
462  state.denoising_tiles[state.tiles[nindex].device].push_back(nindex);
463  }
464  }
465  return false;
466  }
467  case Tile::DENOISE: {
468  state.tiles[index].state = Tile::DENOISED;
469  /* For each neighbor and the tile itself, check whether all of its neighbors have been
470  * denoised. If yes, it can be freed. */
471  for (int neighbor = 0; neighbor < 9; neighbor++) {
472  int nindex = get_neighbor_index(index, neighbor);
473  if (check_neighbor_state(nindex, Tile::DENOISED)) {
474  state.tiles[nindex].state = Tile::DONE;
475  /* Do not delete finished tiles in progressive mode. */
476  if (!progressive) {
477  /* It can happen that the tile just finished denoising and already can be freed here.
478  * However, in that case it still has to be written before deleting, so we can't delete
479  * it yet. */
480  if (neighbor == 4) {
481  delete_tile = true;
482  }
483  else {
484  delete state.tiles[nindex].buffers;
485  state.tiles[nindex].buffers = NULL;
486  }
487  }
488  }
489  }
490  return true;
491  }
492  default:
493  assert(false);
494  return true;
495  }
496 }
497 
498 bool TileManager::next_tile(Tile *&tile, int device, uint tile_types)
499 {
500  /* Preserve device if requested, unless this is a separate denoising device that just wants to
501  * grab any available tile. */
502  const bool preserve_device = preserve_tile_device && device < num_devices;
503 
504  if (tile_types & RenderTile::DENOISE) {
505  int tile_index = -1;
506  int logical_device = preserve_device ? device : 0;
507 
508  while (logical_device < state.denoising_tiles.size()) {
509  if (state.denoising_tiles[logical_device].empty()) {
510  if (preserve_device) {
511  break;
512  }
513  else {
514  logical_device++;
515  continue;
516  }
517  }
518 
519  tile_index = state.denoising_tiles[logical_device].front();
520  state.denoising_tiles[logical_device].pop_front();
521  break;
522  }
523 
524  if (tile_index >= 0) {
525  tile = &state.tiles[tile_index];
526  return true;
527  }
528  }
529 
530  if (tile_types & RenderTile::PATH_TRACE) {
531  int tile_index = -1;
532  int logical_device = preserve_device ? device : 0;
533 
534  while (logical_device < state.render_tiles.size()) {
535  if (state.render_tiles[logical_device].empty()) {
536  if (preserve_device) {
537  break;
538  }
539  else {
540  logical_device++;
541  continue;
542  }
543  }
544 
545  tile_index = state.render_tiles[logical_device].front();
546  state.render_tiles[logical_device].pop_front();
547  break;
548  }
549 
550  if (tile_index >= 0) {
551  tile = &state.tiles[tile_index];
552  return true;
553  }
554  }
555 
556  return false;
557 }
558 
560 {
561  int end_sample = (range_num_samples == -1) ? num_samples :
563  return (state.resolution_divider == pixel_size) &&
564  (state.sample + state.num_samples >= end_sample);
565 }
566 
568 {
569  foreach (Tile &tile, state.tiles) {
570  if (tile.state != Tile::DONE) {
571  return true;
572  }
573  }
574  return false;
575 }
576 
578 {
579  if (done())
580  return false;
581 
583  state.sample = 0;
585  state.num_samples = 1;
586  set_tiles();
587  }
588  else {
589  state.sample++;
590 
591  if (progressive)
592  state.num_samples = 1;
593  else if (range_num_samples == -1)
595  else
597 
599 
601  set_tiles();
602  }
603  else {
605  }
606  }
607 
608  return true;
609 }
610 
612 {
614 }
615 
unsigned int uint
Definition: BLI_sys_types.h:83
void swap(T &a, T &b)
Definition: Common.h:33
NSNotificationCenter * center
_GL_VOID GLfloat value _GL_VOID_RET _GL_VOID const GLuint GLboolean *residences _GL_BOOL_RET _GL_VOID GLsizei GLfloat GLfloat GLfloat GLfloat const GLubyte *bitmap _GL_VOID_RET _GL_VOID GLenum const void *lists _GL_VOID_RET _GL_VOID const GLdouble *equation _GL_VOID_RET _GL_VOID GLdouble GLdouble blue _GL_VOID_RET _GL_VOID GLfloat GLfloat blue _GL_VOID_RET _GL_VOID GLint GLint blue _GL_VOID_RET _GL_VOID GLshort GLshort blue _GL_VOID_RET _GL_VOID GLubyte GLubyte blue _GL_VOID_RET _GL_VOID GLuint GLuint blue _GL_VOID_RET _GL_VOID GLushort GLushort blue _GL_VOID_RET _GL_VOID GLbyte GLbyte GLbyte alpha _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble alpha _GL_VOID_RET _GL_VOID GLfloat GLfloat GLfloat alpha _GL_VOID_RET _GL_VOID GLint GLint GLint alpha _GL_VOID_RET _GL_VOID GLshort GLshort GLshort alpha _GL_VOID_RET _GL_VOID GLubyte GLubyte GLubyte alpha _GL_VOID_RET _GL_VOID GLuint GLuint GLuint alpha _GL_VOID_RET _GL_VOID GLushort GLushort GLushort alpha _GL_VOID_RET _GL_VOID GLenum mode _GL_VOID_RET _GL_VOID GLint GLsizei GLsizei GLenum type _GL_VOID_RET _GL_VOID GLsizei GLenum GLenum const void *pixels _GL_VOID_RET _GL_VOID const void *pointer _GL_VOID_RET _GL_VOID GLdouble v _GL_VOID_RET _GL_VOID GLfloat v _GL_VOID_RET _GL_VOID GLint GLint i2 _GL_VOID_RET _GL_VOID GLint j _GL_VOID_RET _GL_VOID GLfloat param _GL_VOID_RET _GL_VOID GLint param _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble GLdouble GLdouble zFar _GL_VOID_RET _GL_UINT GLdouble *equation _GL_VOID_RET _GL_VOID GLenum GLint *params _GL_VOID_RET _GL_VOID GLenum GLfloat *v _GL_VOID_RET _GL_VOID GLenum GLfloat *params _GL_VOID_RET _GL_VOID GLfloat *values _GL_VOID_RET _GL_VOID GLushort *values _GL_VOID_RET _GL_VOID GLenum GLfloat *params _GL_VOID_RET _GL_VOID GLenum GLdouble *params _GL_VOID_RET _GL_VOID GLenum GLint *params _GL_VOID_RET _GL_VOID GLsizei const void *pointer _GL_VOID_RET _GL_VOID GLsizei const void *pointer _GL_VOID_RET _GL_BOOL GLfloat param _GL_VOID_RET _GL_VOID GLint param _GL_VOID_RET _GL_VOID GLenum GLfloat param _GL_VOID_RET _GL_VOID GLenum GLint param _GL_VOID_RET _GL_VOID GLushort pattern _GL_VOID_RET _GL_VOID GLdouble GLdouble GLint GLint const GLdouble *points _GL_VOID_RET _GL_VOID GLdouble GLdouble GLint GLint GLdouble GLdouble GLint GLint const GLdouble *points _GL_VOID_RET _GL_VOID GLdouble GLdouble u2 _GL_VOID_RET _GL_VOID GLdouble GLdouble GLint GLdouble GLdouble v2 _GL_VOID_RET _GL_VOID GLenum GLfloat param _GL_VOID_RET _GL_VOID GLenum GLint param _GL_VOID_RET _GL_VOID GLenum mode _GL_VOID_RET _GL_VOID GLdouble GLdouble nz _GL_VOID_RET _GL_VOID GLfloat GLfloat nz _GL_VOID_RET _GL_VOID GLint GLint nz _GL_VOID_RET _GL_VOID GLshort GLshort nz _GL_VOID_RET _GL_VOID GLsizei const void *pointer _GL_VOID_RET _GL_VOID GLsizei const GLfloat *values _GL_VOID_RET _GL_VOID GLsizei const GLushort *values _GL_VOID_RET _GL_VOID GLint param _GL_VOID_RET _GL_VOID const GLuint const GLclampf *priorities _GL_VOID_RET _GL_VOID GLdouble y _GL_VOID_RET _GL_VOID GLfloat y _GL_VOID_RET _GL_VOID GLint y _GL_VOID_RET _GL_VOID GLshort y _GL_VOID_RET _GL_VOID GLdouble GLdouble z _GL_VOID_RET _GL_VOID GLfloat GLfloat z _GL_VOID_RET _GL_VOID GLint GLint z _GL_VOID_RET _GL_VOID GLshort GLshort z _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble w _GL_VOID_RET _GL_VOID GLfloat GLfloat GLfloat w _GL_VOID_RET _GL_VOID GLint GLint GLint w _GL_VOID_RET _GL_VOID GLshort GLshort GLshort w _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble y2 _GL_VOID_RET _GL_VOID GLfloat GLfloat GLfloat y2 _GL_VOID_RET _GL_VOID GLint GLint GLint y2 _GL_VOID_RET _GL_VOID GLshort GLshort GLshort y2 _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble z _GL_VOID_RET _GL_VOID GLdouble GLdouble z _GL_VOID_RET _GL_VOID GLuint *buffer _GL_VOID_RET _GL_VOID GLdouble t _GL_VOID_RET _GL_VOID GLfloat t _GL_VOID_RET _GL_VOID GLint t _GL_VOID_RET _GL_VOID GLshort t _GL_VOID_RET _GL_VOID GLdouble GLdouble r _GL_VOID_RET _GL_VOID GLfloat GLfloat r _GL_VOID_RET _GL_VOID GLint GLint r _GL_VOID_RET _GL_VOID GLshort GLshort r _GL_VOID_RET _GL_VOID GLdouble GLdouble r
_GL_VOID GLfloat value _GL_VOID_RET _GL_VOID const GLuint GLboolean *residences _GL_BOOL_RET _GL_VOID GLsizei GLfloat GLfloat GLfloat GLfloat const GLubyte *bitmap _GL_VOID_RET _GL_VOID GLenum const void *lists _GL_VOID_RET _GL_VOID const GLdouble *equation _GL_VOID_RET _GL_VOID GLdouble GLdouble blue _GL_VOID_RET _GL_VOID GLfloat GLfloat blue _GL_VOID_RET _GL_VOID GLint GLint blue _GL_VOID_RET _GL_VOID GLshort GLshort blue _GL_VOID_RET _GL_VOID GLubyte GLubyte blue _GL_VOID_RET _GL_VOID GLuint GLuint blue _GL_VOID_RET _GL_VOID GLushort GLushort blue _GL_VOID_RET _GL_VOID GLbyte GLbyte GLbyte alpha _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble alpha _GL_VOID_RET _GL_VOID GLfloat GLfloat GLfloat alpha _GL_VOID_RET _GL_VOID GLint GLint GLint alpha _GL_VOID_RET _GL_VOID GLshort GLshort GLshort alpha _GL_VOID_RET _GL_VOID GLubyte GLubyte GLubyte alpha _GL_VOID_RET _GL_VOID GLuint GLuint GLuint alpha _GL_VOID_RET _GL_VOID GLushort GLushort GLushort alpha _GL_VOID_RET _GL_VOID GLenum mode _GL_VOID_RET _GL_VOID GLint GLsizei GLsizei GLenum type _GL_VOID_RET _GL_VOID GLsizei GLenum GLenum const void *pixels _GL_VOID_RET _GL_VOID const void *pointer _GL_VOID_RET _GL_VOID GLdouble v _GL_VOID_RET _GL_VOID GLfloat v _GL_VOID_RET _GL_VOID GLint GLint i2 _GL_VOID_RET _GL_VOID GLint j _GL_VOID_RET _GL_VOID GLfloat param _GL_VOID_RET _GL_VOID GLint param _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble GLdouble GLdouble zFar _GL_VOID_RET _GL_UINT GLdouble *equation _GL_VOID_RET _GL_VOID GLenum GLint *params _GL_VOID_RET _GL_VOID GLenum GLfloat *v _GL_VOID_RET _GL_VOID GLenum GLfloat *params _GL_VOID_RET _GL_VOID GLfloat *values _GL_VOID_RET _GL_VOID GLushort *values _GL_VOID_RET _GL_VOID GLenum GLfloat *params _GL_VOID_RET _GL_VOID GLenum GLdouble *params _GL_VOID_RET _GL_VOID GLenum GLint *params _GL_VOID_RET _GL_VOID GLsizei const void *pointer _GL_VOID_RET _GL_VOID GLsizei const void *pointer _GL_VOID_RET _GL_BOOL GLfloat param _GL_VOID_RET _GL_VOID GLint param _GL_VOID_RET _GL_VOID GLenum GLfloat param _GL_VOID_RET _GL_VOID GLenum GLint param _GL_VOID_RET _GL_VOID GLushort pattern _GL_VOID_RET _GL_VOID GLdouble GLdouble GLint GLint const GLdouble *points _GL_VOID_RET _GL_VOID GLdouble GLdouble GLint GLint GLdouble GLdouble GLint GLint const GLdouble *points _GL_VOID_RET _GL_VOID GLdouble GLdouble u2 _GL_VOID_RET _GL_VOID GLdouble GLdouble GLint GLdouble GLdouble v2 _GL_VOID_RET _GL_VOID GLenum GLfloat param _GL_VOID_RET _GL_VOID GLenum GLint param _GL_VOID_RET _GL_VOID GLenum mode _GL_VOID_RET _GL_VOID GLdouble ny
_GL_VOID GLfloat value _GL_VOID_RET _GL_VOID const GLuint GLboolean *residences _GL_BOOL_RET _GL_VOID GLsizei GLfloat GLfloat GLfloat GLfloat const GLubyte *bitmap _GL_VOID_RET _GL_VOID GLenum const void *lists _GL_VOID_RET _GL_VOID const GLdouble *equation _GL_VOID_RET _GL_VOID GLdouble GLdouble blue _GL_VOID_RET _GL_VOID GLfloat GLfloat blue _GL_VOID_RET _GL_VOID GLint GLint blue _GL_VOID_RET _GL_VOID GLshort GLshort blue _GL_VOID_RET _GL_VOID GLubyte GLubyte blue _GL_VOID_RET _GL_VOID GLuint GLuint blue _GL_VOID_RET _GL_VOID GLushort GLushort blue _GL_VOID_RET _GL_VOID GLbyte GLbyte GLbyte alpha _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble alpha _GL_VOID_RET _GL_VOID GLfloat GLfloat GLfloat alpha _GL_VOID_RET _GL_VOID GLint GLint GLint alpha _GL_VOID_RET _GL_VOID GLshort GLshort GLshort alpha _GL_VOID_RET _GL_VOID GLubyte GLubyte GLubyte alpha _GL_VOID_RET _GL_VOID GLuint GLuint GLuint alpha _GL_VOID_RET _GL_VOID GLushort GLushort GLushort alpha _GL_VOID_RET _GL_VOID GLenum mode _GL_VOID_RET _GL_VOID GLint y
_GL_VOID GLfloat value _GL_VOID_RET _GL_VOID const GLuint GLboolean *residences _GL_BOOL_RET _GL_VOID GLsizei GLfloat GLfloat GLfloat GLfloat const GLubyte *bitmap _GL_VOID_RET _GL_VOID GLenum const void *lists _GL_VOID_RET _GL_VOID const GLdouble *equation _GL_VOID_RET _GL_VOID GLdouble GLdouble blue _GL_VOID_RET _GL_VOID GLfloat GLfloat blue _GL_VOID_RET _GL_VOID GLint GLint blue _GL_VOID_RET _GL_VOID GLshort GLshort blue _GL_VOID_RET _GL_VOID GLubyte GLubyte blue _GL_VOID_RET _GL_VOID GLuint GLuint blue _GL_VOID_RET _GL_VOID GLushort GLushort blue _GL_VOID_RET _GL_VOID GLbyte GLbyte GLbyte alpha _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble alpha _GL_VOID_RET _GL_VOID GLfloat GLfloat GLfloat alpha _GL_VOID_RET _GL_VOID GLint GLint GLint alpha _GL_VOID_RET _GL_VOID GLshort GLshort GLshort alpha _GL_VOID_RET _GL_VOID GLubyte GLubyte GLubyte alpha _GL_VOID_RET _GL_VOID GLuint GLuint GLuint alpha _GL_VOID_RET _GL_VOID GLushort GLushort GLushort alpha _GL_VOID_RET _GL_VOID GLenum mode _GL_VOID_RET _GL_VOID GLint GLsizei GLsizei GLenum type _GL_VOID_RET _GL_VOID GLsizei GLenum GLenum const void *pixels _GL_VOID_RET _GL_VOID const void *pointer _GL_VOID_RET _GL_VOID GLdouble v _GL_VOID_RET _GL_VOID GLfloat v _GL_VOID_RET _GL_VOID GLint GLint i2 _GL_VOID_RET _GL_VOID GLint j _GL_VOID_RET _GL_VOID GLfloat param _GL_VOID_RET _GL_VOID GLint param _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble GLdouble GLdouble zFar _GL_VOID_RET _GL_UINT GLdouble *equation _GL_VOID_RET _GL_VOID GLenum GLint *params _GL_VOID_RET _GL_VOID GLenum GLfloat *v _GL_VOID_RET _GL_VOID GLenum GLfloat *params _GL_VOID_RET _GL_VOID GLfloat *values _GL_VOID_RET _GL_VOID GLushort *values _GL_VOID_RET _GL_VOID GLenum GLfloat *params _GL_VOID_RET _GL_VOID GLenum GLdouble *params _GL_VOID_RET _GL_VOID GLenum GLint *params _GL_VOID_RET _GL_VOID GLsizei const void *pointer _GL_VOID_RET _GL_VOID GLsizei const void *pointer _GL_VOID_RET _GL_BOOL GLfloat param _GL_VOID_RET _GL_VOID GLint param _GL_VOID_RET _GL_VOID GLenum GLfloat param _GL_VOID_RET _GL_VOID GLenum GLint param _GL_VOID_RET _GL_VOID GLushort pattern _GL_VOID_RET _GL_VOID GLdouble GLdouble GLint GLint order
SIMD_FORCE_INLINE const btScalar & w() const
Return the w value.
Definition: btQuadWord.h:119
int width
Definition: buffers.h:43
int full_x
Definition: buffers.h:47
int full_width
Definition: buffers.h:49
int height
Definition: buffers.h:44
int full_height
Definition: buffers.h:50
int full_y
Definition: buffers.h:48
bool operator()(int a, int b)
Definition: tile.cpp:34
TileComparator(TileOrder order_, int2 center_, Tile *tiles_)
Definition: tile.cpp:29
@ PATH_TRACE
Definition: buffers.h:134
int range_start_sample
Definition: tile.h:125
TileOrder tile_order
Definition: tile.h:141
int start_resolution
Definition: tile.h:142
int range_num_samples
Definition: tile.h:128
void device_free()
Definition: tile.cpp:122
void reset(BufferParams &params, int num_samples)
Definition: tile.cpp:148
int get_neighbor_index(int index, int neighbor)
Definition: tile.cpp:394
bool next_tile(Tile *&tile, int device, uint tile_types)
Definition: tile.cpp:498
bool done()
Definition: tile.cpp:559
int slice_overlap
Definition: tile.h:92
bool check_neighbor_state(int index, Tile::State state)
Definition: tile.cpp:426
bool next()
Definition: tile.cpp:577
bool finish_tile(const int index, const bool need_denoise, bool &delete_tile)
Definition: tile.cpp:444
bool progressive
Definition: tile.h:139
bool has_tiles()
Definition: tile.cpp:567
void set_tiles()
Definition: tile.cpp:377
bool background
Definition: tile.h:163
~TileManager()
Definition: tile.cpp:118
struct TileManager::State state
bool preserve_tile_device
Definition: tile.h:153
int get_num_effective_samples()
Definition: tile.cpp:611
int2 tile_size
Definition: tile.h:140
int gen_tiles(bool sliced)
Definition: tile.cpp:198
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, int pixel_size=1)
Definition: tile.cpp:89
void gen_render_tiles()
Definition: tile.cpp:368
int pixel_size
Definition: tile.h:143
int num_samples
Definition: tile.h:91
bool schedule_denoising
Definition: tile.h:134
int num_devices
Definition: tile.h:144
void set_samples(int num_samples)
Definition: tile.cpp:164
BufferParams params
Definition: tile.h:69
Definition: tile.h:29
int index
Definition: tile.h:31
State state
Definition: tile.h:40
int device
Definition: tile.h:33
State
Definition: tile.h:39
@ DONE
Definition: tile.h:39
@ DENOISED
Definition: tile.h:39
@ RENDERED
Definition: tile.h:39
@ RENDER
Definition: tile.h:39
@ DENOISE
Definition: tile.h:39
uint pos
#define CCL_NAMESPACE_END
#define make_float2(x, y)
#define make_int2(x, y)
int2 hilbert_index_to_pos(int n, int d)
Definition: tile.cpp:62
static unsigned a[3]
Definition: RandGen.cpp:92
#define min(a, b)
Definition: sort.c:51
unsigned __int64 uint64_t
Definition: stdint.h:93
int tile_stride
Definition: tile.h:73
vector< list< int > > denoising_tiles
Definition: tile.h:88
BufferParams buffer
Definition: tile.h:74
vector< list< int > > render_tiles
Definition: tile.h:87
int resolution_divider
Definition: tile.h:77
uint64_t total_pixel_samples
Definition: tile.h:82
int num_samples
Definition: tile.h:76
vector< Tile > tiles
Definition: tile.h:72
static int get_divider(int w, int h, int start_resolution)
Definition: tile.cpp:134
TileOrder
Definition: tile.h:56
@ TILE_CENTER
Definition: tile.h:57
@ TILE_TOP_TO_BOTTOM
Definition: tile.h:60
@ TILE_BOTTOM_TO_TOP
Definition: tile.h:61
@ TILE_HILBERT_SPIRAL
Definition: tile.h:62
@ TILE_RIGHT_TO_LEFT
Definition: tile.h:58
@ TILE_LEFT_TO_RIGHT
Definition: tile.h:59
float max
ccl_device_inline float dot(const float2 &a, const float2 &b)
ccl_device_inline size_t divide_up(size_t x, size_t y)
Definition: util_types.h:70