diff options
author | Brecht Van Lommel <brechtvanlommel@gmail.com> | 2017-09-27 00:42:36 +0300 |
---|---|---|
committer | Brecht Van Lommel <brechtvanlommel@gmail.com> | 2017-10-04 22:11:14 +0300 |
commit | 5b7d6ea54b2fc35b8b12c667f5bf9a1c9c46d5c2 (patch) | |
tree | 99a9ca07d5366b164dfdf267ad1ed3691d2d7d57 /intern/cycles/kernel/split/kernel_path_init.h | |
parent | 660e8e59e7b4265324a8fba7ae716f84a73c6c64 (diff) |
Code refactor: add WorkTile struct for passing work to kernel.
This makes sharing some code between mega/split in following commits a bit
easier, and also paves the way for rendering multiple tiles later.
Diffstat (limited to 'intern/cycles/kernel/split/kernel_path_init.h')
-rw-r--r-- | intern/cycles/kernel/split/kernel_path_init.h | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/intern/cycles/kernel/split/kernel_path_init.h b/intern/cycles/kernel/split/kernel_path_init.h index 0ab2289348b..701d39403ad 100644 --- a/intern/cycles/kernel/split/kernel_path_init.h +++ b/intern/cycles/kernel/split/kernel_path_init.h @@ -30,23 +30,28 @@ ccl_device void kernel_path_init(KernelGlobals *kg) { kernel_split_state.ray_state[ray_index] = RAY_ACTIVE; /* Get work. */ + ccl_global uint *work_pools = kernel_split_params.work_pools; + uint total_work_size = kernel_split_params.total_work_size; uint work_index; - if(!get_next_work(kg, ray_index, &work_index)) { + + if(!get_next_work(kg, work_pools, total_work_size, ray_index, &work_index)) { /* No more work, mark ray as inactive */ kernel_split_state.ray_state[ray_index] = RAY_INACTIVE; return; } + ccl_global WorkTile *tile = &kernel_split_params.tile; uint x, y, sample; - get_work_pixel(kg, work_index, &x, &y, &sample); + get_work_pixel(tile, work_index, &x, &y, &sample); /* Remap rng_state and buffer to current pixel. */ - ccl_global uint *rng_state = kernel_split_params.rng_state; - rng_state += kernel_split_params.offset + x + y*kernel_split_params.stride; + ccl_global uint *rng_state = kernel_split_params.tile.rng_state; + rng_state += tile->offset + x + y*tile->stride; /* Store buffer offset for writing to passes. */ - uint buffer_offset = (kernel_split_params.offset + x + y*kernel_split_params.stride) * kernel_data.film.pass_stride; + uint buffer_offset = (tile->offset + x + y*tile->stride) * kernel_data.film.pass_stride; + ccl_global float *buffer = tile->buffer + buffer_offset; kernel_split_state.buffer_offset[ray_index] = buffer_offset; /* Initialize random numbers and ray. */ @@ -78,7 +83,6 @@ ccl_device void kernel_path_init(KernelGlobals *kg) { /* These rays do not participate in path-iteration. */ float4 L_rad = make_float4(0.0f, 0.0f, 0.0f, 0.0f); /* Accumulate result in output buffer. */ - ccl_global float *buffer = kernel_split_params.buffer + buffer_offset; kernel_write_pass_float4(buffer, sample, L_rad); ASSIGN_RAY_STATE(kernel_split_state.ray_state, ray_index, RAY_TO_REGENERATE); } |