diff options
author | Brecht Van Lommel <brecht@blender.org> | 2021-10-24 15:19:19 +0300 |
---|---|---|
committer | Brecht Van Lommel <brecht@blender.org> | 2021-10-26 16:36:39 +0300 |
commit | d7d40745fa09061a3117bd3669c5a46bbf611eae (patch) | |
tree | 8dbaca086ecbb09aad62c25e9ece66332fe79af3 /intern/cycles/kernel/device | |
parent | b698fe1e047e56e8ed67ba47464c0017d9c50eea (diff) |
Cycles: changes to source code folders structure
* Split render/ into scene/ and session/. The scene/ folder now contains the
scene and its nodes. The session/ folder contains the render session and
associated data structures like drivers and render buffers.
* Move top level kernel headers into new folders kernel/camera/, kernel/film/,
kernel/light/, kernel/sample/, kernel/util/
* Move integrator related kernel headers into kernel/integrator/
* Move OSL shaders from kernel/shaders/ to kernel/osl/shaders/
For patches and branches, git merge and rebase should be able to detect the
renames and move over code to the right file.
Diffstat (limited to 'intern/cycles/kernel/device')
-rw-r--r-- | intern/cycles/kernel/device/cpu/globals.h | 2 | ||||
-rw-r--r-- | intern/cycles/kernel/device/cpu/kernel_arch_impl.h | 9 | ||||
-rw-r--r-- | intern/cycles/kernel/device/cuda/globals.h | 3 | ||||
-rw-r--r-- | intern/cycles/kernel/device/gpu/kernel.h | 9 | ||||
-rw-r--r-- | intern/cycles/kernel/device/gpu/work_stealing.h | 52 | ||||
-rw-r--r-- | intern/cycles/kernel/device/hip/globals.h | 3 | ||||
-rw-r--r-- | intern/cycles/kernel/device/optix/globals.h | 3 |
7 files changed, 69 insertions, 12 deletions
diff --git a/intern/cycles/kernel/device/cpu/globals.h b/intern/cycles/kernel/device/cpu/globals.h index fb9aae38cfc..f3e530a9edc 100644 --- a/intern/cycles/kernel/device/cpu/globals.h +++ b/intern/cycles/kernel/device/cpu/globals.h @@ -18,8 +18,8 @@ #pragma once -#include "kernel/kernel_profiling.h" #include "kernel/kernel_types.h" +#include "kernel/util/util_profiling.h" CCL_NAMESPACE_BEGIN diff --git a/intern/cycles/kernel/device/cpu/kernel_arch_impl.h b/intern/cycles/kernel/device/cpu/kernel_arch_impl.h index ba777062113..148b6a33cb5 100644 --- a/intern/cycles/kernel/device/cpu/kernel_arch_impl.h +++ b/intern/cycles/kernel/device/cpu/kernel_arch_impl.h @@ -46,10 +46,11 @@ # include "kernel/integrator/integrator_shade_volume.h" # include "kernel/integrator/integrator_megakernel.h" -# include "kernel/kernel_film.h" -# include "kernel/kernel_adaptive_sampling.h" -# include "kernel/kernel_bake.h" -# include "kernel/kernel_id_passes.h" +# include "kernel/film/film_adaptive_sampling.h" +# include "kernel/film/film_read.h" +# include "kernel/film/film_id_passes.h" + +# include "kernel/bake/bake.h" #else # define STUB_ASSERT(arch, name) \ diff --git a/intern/cycles/kernel/device/cuda/globals.h b/intern/cycles/kernel/device/cuda/globals.h index 2c187cf8a23..cde935198b3 100644 --- a/intern/cycles/kernel/device/cuda/globals.h +++ b/intern/cycles/kernel/device/cuda/globals.h @@ -18,11 +18,12 @@ #pragma once -#include "kernel/kernel_profiling.h" #include "kernel/kernel_types.h" #include "kernel/integrator/integrator_state.h" +#include "kernel/util/util_profiling.h" + CCL_NAMESPACE_BEGIN /* Not actually used, just a NULL pointer that gets passed everywhere, which we diff --git a/intern/cycles/kernel/device/gpu/kernel.h b/intern/cycles/kernel/device/gpu/kernel.h index 335cb1ec0c0..aa360b3016a 100644 --- a/intern/cycles/kernel/device/gpu/kernel.h +++ b/intern/cycles/kernel/device/gpu/kernel.h @@ -19,6 +19,7 @@ #include "kernel/device/gpu/parallel_active_index.h" #include "kernel/device/gpu/parallel_prefix_sum.h" #include "kernel/device/gpu/parallel_sorted_index.h" +#include "kernel/device/gpu/work_stealing.h" #include "kernel/integrator/integrator_state.h" #include "kernel/integrator/integrator_state_flow.h" @@ -36,10 +37,10 @@ #include "kernel/integrator/integrator_shade_surface.h" #include "kernel/integrator/integrator_shade_volume.h" -#include "kernel/kernel_adaptive_sampling.h" -#include "kernel/kernel_bake.h" -#include "kernel/kernel_film.h" -#include "kernel/kernel_work_stealing.h" +#include "kernel/bake/bake.h" + +#include "kernel/film/film_adaptive_sampling.h" +#include "kernel/film/film_read.h" /* -------------------------------------------------------------------- * Integrator. diff --git a/intern/cycles/kernel/device/gpu/work_stealing.h b/intern/cycles/kernel/device/gpu/work_stealing.h new file mode 100644 index 00000000000..fab0915c38e --- /dev/null +++ b/intern/cycles/kernel/device/gpu/work_stealing.h @@ -0,0 +1,52 @@ +/* + * Copyright 2011-2015 Blender Foundation + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#pragma once + +CCL_NAMESPACE_BEGIN + +/* + * Utility functions for work stealing + */ + +/* Map global work index to tile, pixel X/Y and sample. */ +ccl_device_inline void get_work_pixel(ccl_global const KernelWorkTile *tile, + uint global_work_index, + ccl_private uint *x, + ccl_private uint *y, + ccl_private uint *sample) +{ +#if 0 + /* Keep threads for the same sample together. */ + uint tile_pixels = tile->w * tile->h; + uint sample_offset = global_work_index / tile_pixels; + uint pixel_offset = global_work_index - sample_offset * tile_pixels; +#else + /* Keeping threads for the same pixel together. + * Appears to improve performance by a few % on CUDA and OptiX. */ + uint sample_offset = global_work_index % tile->num_samples; + uint pixel_offset = global_work_index / tile->num_samples; +#endif + + uint y_offset = pixel_offset / tile->w; + uint x_offset = pixel_offset - y_offset * tile->w; + + *x = tile->x + x_offset; + *y = tile->y + y_offset; + *sample = tile->start_sample + sample_offset; +} + +CCL_NAMESPACE_END diff --git a/intern/cycles/kernel/device/hip/globals.h b/intern/cycles/kernel/device/hip/globals.h index 28e1cc4282f..079944bd8f2 100644 --- a/intern/cycles/kernel/device/hip/globals.h +++ b/intern/cycles/kernel/device/hip/globals.h @@ -18,11 +18,12 @@ #pragma once -#include "kernel/kernel_profiling.h" #include "kernel/kernel_types.h" #include "kernel/integrator/integrator_state.h" +#include "kernel/util/util_profiling.h" + CCL_NAMESPACE_BEGIN /* Not actually used, just a NULL pointer that gets passed everywhere, which we diff --git a/intern/cycles/kernel/device/optix/globals.h b/intern/cycles/kernel/device/optix/globals.h index 7b8ebfe50e6..e038bc1797a 100644 --- a/intern/cycles/kernel/device/optix/globals.h +++ b/intern/cycles/kernel/device/optix/globals.h @@ -18,11 +18,12 @@ #pragma once -#include "kernel/kernel_profiling.h" #include "kernel/kernel_types.h" #include "kernel/integrator/integrator_state.h" +#include "kernel/util/util_profiling.h" + CCL_NAMESPACE_BEGIN /* Not actually used, just a NULL pointer that gets passed everywhere, which we |