2022-02-11 09:07:11 +11:00
|
|
|
# SPDX-License-Identifier: Apache-2.0
|
2022-02-11 13:53:21 +01:00
|
|
|
# Copyright 2011-2022 Blender Foundation
|
2020-09-04 18:41:10 +02:00
|
|
|
|
2015-03-27 15:55:58 +05:00
|
|
|
remove_extra_strict_flags()
|
|
|
|
|
2011-11-08 20:27:37 +00:00
|
|
|
set(INC
|
Cycles: Make all #include statements relative to cycles source directory
The idea is to make include statements more explicit and obvious where the
file is coming from, additionally reducing chance of wrong header being
picked up.
For example, it was not obvious whether bvh.h was refferring to builder
or traversal, whenter node.h is a generic graph node or a shader node
and cases like that.
Surely this might look obvious for the active developers, but after some
time of not touching the code it becomes less obvious where file is coming
from.
This was briefly mentioned in T50824 and seems @brecht is fine with such
explicitness, but need to agree with all active developers before committing
this.
Please note that this patch is lacking changes related on GPU/OpenCL
support. This will be solved if/when we all agree this is a good idea to move
forward.
Reviewers: brecht, lukasstockner97, maiself, nirved, dingto, juicyfruit, swerner
Reviewed By: lukasstockner97, maiself, nirved, dingto
Subscribers: brecht
Differential Revision: https://developer.blender.org/D2586
2017-03-28 20:39:14 +02:00
|
|
|
..
|
2011-11-08 20:27:37 +00:00
|
|
|
)
|
2012-10-17 04:13:03 +00:00
|
|
|
|
2012-09-20 09:04:43 +00:00
|
|
|
set(INC_SYS
|
2012-10-17 04:13:03 +00:00
|
|
|
|
2012-09-20 09:04:43 +00:00
|
|
|
)
|
2011-11-08 20:27:37 +00:00
|
|
|
|
2021-10-26 16:13:39 +02:00
|
|
|
set(SRC_KERNEL_DEVICE_CPU
|
Cycles: merge of cycles-x branch, a major update to the renderer
This includes much improved GPU rendering performance, viewport interactivity,
new shadow catcher, revamped sampling settings, subsurface scattering anisotropy,
new GPU volume sampling, improved PMJ sampling pattern, and more.
Some features have also been removed or changed, breaking backwards compatibility.
Including the removal of the OpenCL backend, for which alternatives are under
development.
Release notes and code docs:
https://wiki.blender.org/wiki/Reference/Release_Notes/3.0/Cycles
https://wiki.blender.org/wiki/Source/Render/Cycles
Credits:
* Sergey Sharybin
* Brecht Van Lommel
* Patrick Mours (OptiX backend)
* Christophe Hery (subsurface scattering anisotropy)
* William Leeson (PMJ sampling pattern)
* Alaska (various fixes and tweaks)
* Thomas Dinges (various fixes)
For the full commit history, see the cycles-x branch. This squashes together
all the changes since intermediate changes would often fail building or tests.
Ref T87839, T87837, T87836
Fixes T90734, T89353, T80267, T80267, T77185, T69800
2021-09-20 17:59:20 +02:00
|
|
|
device/cpu/kernel.cpp
|
|
|
|
device/cpu/kernel_sse2.cpp
|
|
|
|
device/cpu/kernel_sse3.cpp
|
|
|
|
device/cpu/kernel_sse41.cpp
|
|
|
|
device/cpu/kernel_avx.cpp
|
|
|
|
device/cpu/kernel_avx2.cpp
|
2017-10-07 14:08:02 +02:00
|
|
|
)
|
|
|
|
|
2021-10-26 16:13:39 +02:00
|
|
|
set(SRC_KERNEL_DEVICE_CUDA
|
Cycles: merge of cycles-x branch, a major update to the renderer
This includes much improved GPU rendering performance, viewport interactivity,
new shadow catcher, revamped sampling settings, subsurface scattering anisotropy,
new GPU volume sampling, improved PMJ sampling pattern, and more.
Some features have also been removed or changed, breaking backwards compatibility.
Including the removal of the OpenCL backend, for which alternatives are under
development.
Release notes and code docs:
https://wiki.blender.org/wiki/Reference/Release_Notes/3.0/Cycles
https://wiki.blender.org/wiki/Source/Render/Cycles
Credits:
* Sergey Sharybin
* Brecht Van Lommel
* Patrick Mours (OptiX backend)
* Christophe Hery (subsurface scattering anisotropy)
* William Leeson (PMJ sampling pattern)
* Alaska (various fixes and tweaks)
* Thomas Dinges (various fixes)
For the full commit history, see the cycles-x branch. This squashes together
all the changes since intermediate changes would often fail building or tests.
Ref T87839, T87837, T87836
Fixes T90734, T89353, T80267, T80267, T77185, T69800
2021-09-20 17:59:20 +02:00
|
|
|
device/cuda/kernel.cu
|
2017-10-07 14:08:02 +02:00
|
|
|
)
|
|
|
|
|
2021-10-26 16:13:39 +02:00
|
|
|
set(SRC_KERNEL_DEVICE_HIP
|
2021-09-28 16:51:14 +02:00
|
|
|
device/hip/kernel.cpp
|
|
|
|
)
|
|
|
|
|
Cycles: Adapt shared kernel/device/gpu layer for MSL
This patch adapts the shared kernel entrypoints so that they can be compiled as MSL (Metal Shading Language). Where possible, the adaptations avoid changes in common code.
In MSL, kernel function inputs are explicitly bound to resources. In the case of argument buffers, we declare a struct containing the kernel arguments, accessible via device pointer. This differs from CUDA and HIP where kernel function arguments are declared as traditional C-style function parameters. This patch adapts the entrypoints declared in kernel.h so that they can be translated via a new `ccl_gpu_kernel_signature` macro into the required parameter struct + kernel entrypoint pairing for MSL.
MSL buffer attribution must be applied to function parameters or non-static class data members. To allow universal access to the integrator state, kernel data, and texture fetch adapters, we wrap all of the shared kernel code in a `MetalKernelContext` class. This is achieved by bracketing the appropriate kernel headers with "context_begin.h" and "context_end.h" on Metal. When calling deeper into the kernel code, we must reference the context class (e.g. `context.integrator_init_from_camera`). This extra prefixing is performed by a set of defines in "context_end.h". These will require explicit maintenance if entrypoints change. We invite discussion on more maintainable ways to enforce correctness.
Lambda expressions are not supported on MSL, so a new `ccl_gpu_kernel_lambda` macro generates an inline function object and optionally capturing any required state. This yields the same behaviour. This approach is applied to all parallel_... implementations which are templated by operation. The lambda expressions in the film_convert... kernels don't adapt cleanly to use function objects. However, these entrypoints can be macro-generated more concisely to avoid lambda expressions entirely, instead relying on constant folding to handle the pixel/channel conversions.
A separate implementation of `gpu_parallel_active_index_array` is provided for Metal to workaround some subtle differences in SIMD width, and also to encapsulate some required thread parameters which must be declared as explicit entrypoint function parameters.
Ref T92212
Reviewed By: brecht
Maniphest Tasks: T92212
Differential Revision: https://developer.blender.org/D13109
2021-11-09 21:30:46 +00:00
|
|
|
set(SRC_KERNEL_DEVICE_METAL
|
|
|
|
device/metal/kernel.metal
|
|
|
|
)
|
|
|
|
|
2021-10-26 16:13:39 +02:00
|
|
|
set(SRC_KERNEL_DEVICE_OPTIX
|
Cycles: merge of cycles-x branch, a major update to the renderer
This includes much improved GPU rendering performance, viewport interactivity,
new shadow catcher, revamped sampling settings, subsurface scattering anisotropy,
new GPU volume sampling, improved PMJ sampling pattern, and more.
Some features have also been removed or changed, breaking backwards compatibility.
Including the removal of the OpenCL backend, for which alternatives are under
development.
Release notes and code docs:
https://wiki.blender.org/wiki/Reference/Release_Notes/3.0/Cycles
https://wiki.blender.org/wiki/Source/Render/Cycles
Credits:
* Sergey Sharybin
* Brecht Van Lommel
* Patrick Mours (OptiX backend)
* Christophe Hery (subsurface scattering anisotropy)
* William Leeson (PMJ sampling pattern)
* Alaska (various fixes and tweaks)
* Thomas Dinges (various fixes)
For the full commit history, see the cycles-x branch. This squashes together
all the changes since intermediate changes would often fail building or tests.
Ref T87839, T87837, T87836
Fixes T90734, T89353, T80267, T80267, T77185, T69800
2021-09-20 17:59:20 +02:00
|
|
|
device/optix/kernel.cu
|
|
|
|
device/optix/kernel_shader_raytrace.cu
|
2019-09-12 14:50:06 +02:00
|
|
|
)
|
|
|
|
|
2021-10-26 16:13:39 +02:00
|
|
|
set(SRC_KERNEL_DEVICE_CPU_HEADERS
|
Cycles: merge of cycles-x branch, a major update to the renderer
This includes much improved GPU rendering performance, viewport interactivity,
new shadow catcher, revamped sampling settings, subsurface scattering anisotropy,
new GPU volume sampling, improved PMJ sampling pattern, and more.
Some features have also been removed or changed, breaking backwards compatibility.
Including the removal of the OpenCL backend, for which alternatives are under
development.
Release notes and code docs:
https://wiki.blender.org/wiki/Reference/Release_Notes/3.0/Cycles
https://wiki.blender.org/wiki/Source/Render/Cycles
Credits:
* Sergey Sharybin
* Brecht Van Lommel
* Patrick Mours (OptiX backend)
* Christophe Hery (subsurface scattering anisotropy)
* William Leeson (PMJ sampling pattern)
* Alaska (various fixes and tweaks)
* Thomas Dinges (various fixes)
For the full commit history, see the cycles-x branch. This squashes together
all the changes since intermediate changes would often fail building or tests.
Ref T87839, T87837, T87836
Fixes T90734, T89353, T80267, T80267, T77185, T69800
2021-09-20 17:59:20 +02:00
|
|
|
device/cpu/compat.h
|
|
|
|
device/cpu/image.h
|
|
|
|
device/cpu/globals.h
|
|
|
|
device/cpu/kernel.h
|
|
|
|
device/cpu/kernel_arch.h
|
|
|
|
device/cpu/kernel_arch_impl.h
|
2011-11-08 20:27:37 +00:00
|
|
|
)
|
2021-10-26 16:13:39 +02:00
|
|
|
set(SRC_KERNEL_DEVICE_GPU_HEADERS
|
Cycles: merge of cycles-x branch, a major update to the renderer
This includes much improved GPU rendering performance, viewport interactivity,
new shadow catcher, revamped sampling settings, subsurface scattering anisotropy,
new GPU volume sampling, improved PMJ sampling pattern, and more.
Some features have also been removed or changed, breaking backwards compatibility.
Including the removal of the OpenCL backend, for which alternatives are under
development.
Release notes and code docs:
https://wiki.blender.org/wiki/Reference/Release_Notes/3.0/Cycles
https://wiki.blender.org/wiki/Source/Render/Cycles
Credits:
* Sergey Sharybin
* Brecht Van Lommel
* Patrick Mours (OptiX backend)
* Christophe Hery (subsurface scattering anisotropy)
* William Leeson (PMJ sampling pattern)
* Alaska (various fixes and tweaks)
* Thomas Dinges (various fixes)
For the full commit history, see the cycles-x branch. This squashes together
all the changes since intermediate changes would often fail building or tests.
Ref T87839, T87837, T87836
Fixes T90734, T89353, T80267, T80267, T77185, T69800
2021-09-20 17:59:20 +02:00
|
|
|
device/gpu/image.h
|
|
|
|
device/gpu/kernel.h
|
|
|
|
device/gpu/parallel_active_index.h
|
|
|
|
device/gpu/parallel_prefix_sum.h
|
|
|
|
device/gpu/parallel_sorted_index.h
|
2021-10-24 14:19:19 +02:00
|
|
|
device/gpu/work_stealing.h
|
2017-02-14 05:50:29 -05:00
|
|
|
)
|
|
|
|
|
2021-10-26 16:13:39 +02:00
|
|
|
set(SRC_KERNEL_DEVICE_CUDA_HEADERS
|
Cycles: merge of cycles-x branch, a major update to the renderer
This includes much improved GPU rendering performance, viewport interactivity,
new shadow catcher, revamped sampling settings, subsurface scattering anisotropy,
new GPU volume sampling, improved PMJ sampling pattern, and more.
Some features have also been removed or changed, breaking backwards compatibility.
Including the removal of the OpenCL backend, for which alternatives are under
development.
Release notes and code docs:
https://wiki.blender.org/wiki/Reference/Release_Notes/3.0/Cycles
https://wiki.blender.org/wiki/Source/Render/Cycles
Credits:
* Sergey Sharybin
* Brecht Van Lommel
* Patrick Mours (OptiX backend)
* Christophe Hery (subsurface scattering anisotropy)
* William Leeson (PMJ sampling pattern)
* Alaska (various fixes and tweaks)
* Thomas Dinges (various fixes)
For the full commit history, see the cycles-x branch. This squashes together
all the changes since intermediate changes would often fail building or tests.
Ref T87839, T87837, T87836
Fixes T90734, T89353, T80267, T80267, T77185, T69800
2021-09-20 17:59:20 +02:00
|
|
|
device/cuda/compat.h
|
|
|
|
device/cuda/config.h
|
|
|
|
device/cuda/globals.h
|
2019-09-12 14:50:06 +02:00
|
|
|
)
|
|
|
|
|
2021-10-26 16:13:39 +02:00
|
|
|
set(SRC_KERNEL_DEVICE_HIP_HEADERS
|
2021-09-28 16:51:14 +02:00
|
|
|
device/hip/compat.h
|
|
|
|
device/hip/config.h
|
|
|
|
device/hip/globals.h
|
|
|
|
)
|
|
|
|
|
2021-10-26 16:13:39 +02:00
|
|
|
set(SRC_KERNEL_DEVICE_OPTIX_HEADERS
|
Cycles: merge of cycles-x branch, a major update to the renderer
This includes much improved GPU rendering performance, viewport interactivity,
new shadow catcher, revamped sampling settings, subsurface scattering anisotropy,
new GPU volume sampling, improved PMJ sampling pattern, and more.
Some features have also been removed or changed, breaking backwards compatibility.
Including the removal of the OpenCL backend, for which alternatives are under
development.
Release notes and code docs:
https://wiki.blender.org/wiki/Reference/Release_Notes/3.0/Cycles
https://wiki.blender.org/wiki/Source/Render/Cycles
Credits:
* Sergey Sharybin
* Brecht Van Lommel
* Patrick Mours (OptiX backend)
* Christophe Hery (subsurface scattering anisotropy)
* William Leeson (PMJ sampling pattern)
* Alaska (various fixes and tweaks)
* Thomas Dinges (various fixes)
For the full commit history, see the cycles-x branch. This squashes together
all the changes since intermediate changes would often fail building or tests.
Ref T87839, T87837, T87836
Fixes T90734, T89353, T80267, T80267, T77185, T69800
2021-09-20 17:59:20 +02:00
|
|
|
device/optix/compat.h
|
|
|
|
device/optix/globals.h
|
2017-05-11 19:23:49 -04:00
|
|
|
)
|
|
|
|
|
Cycles: Adapt shared kernel/device/gpu layer for MSL
This patch adapts the shared kernel entrypoints so that they can be compiled as MSL (Metal Shading Language). Where possible, the adaptations avoid changes in common code.
In MSL, kernel function inputs are explicitly bound to resources. In the case of argument buffers, we declare a struct containing the kernel arguments, accessible via device pointer. This differs from CUDA and HIP where kernel function arguments are declared as traditional C-style function parameters. This patch adapts the entrypoints declared in kernel.h so that they can be translated via a new `ccl_gpu_kernel_signature` macro into the required parameter struct + kernel entrypoint pairing for MSL.
MSL buffer attribution must be applied to function parameters or non-static class data members. To allow universal access to the integrator state, kernel data, and texture fetch adapters, we wrap all of the shared kernel code in a `MetalKernelContext` class. This is achieved by bracketing the appropriate kernel headers with "context_begin.h" and "context_end.h" on Metal. When calling deeper into the kernel code, we must reference the context class (e.g. `context.integrator_init_from_camera`). This extra prefixing is performed by a set of defines in "context_end.h". These will require explicit maintenance if entrypoints change. We invite discussion on more maintainable ways to enforce correctness.
Lambda expressions are not supported on MSL, so a new `ccl_gpu_kernel_lambda` macro generates an inline function object and optionally capturing any required state. This yields the same behaviour. This approach is applied to all parallel_... implementations which are templated by operation. The lambda expressions in the film_convert... kernels don't adapt cleanly to use function objects. However, these entrypoints can be macro-generated more concisely to avoid lambda expressions entirely, instead relying on constant folding to handle the pixel/channel conversions.
A separate implementation of `gpu_parallel_active_index_array` is provided for Metal to workaround some subtle differences in SIMD width, and also to encapsulate some required thread parameters which must be declared as explicit entrypoint function parameters.
Ref T92212
Reviewed By: brecht
Maniphest Tasks: T92212
Differential Revision: https://developer.blender.org/D13109
2021-11-09 21:30:46 +00:00
|
|
|
set(SRC_KERNEL_DEVICE_METAL_HEADERS
|
|
|
|
device/metal/compat.h
|
|
|
|
device/metal/context_begin.h
|
|
|
|
device/metal/context_end.h
|
|
|
|
device/metal/globals.h
|
|
|
|
)
|
|
|
|
|
2021-10-26 16:13:39 +02:00
|
|
|
set(SRC_KERNEL_CLOSURE_HEADERS
|
2016-07-25 03:03:23 +02:00
|
|
|
closure/alloc.h
|
2012-10-20 12:18:00 +00:00
|
|
|
closure/bsdf.h
|
|
|
|
closure/bsdf_ashikhmin_velvet.h
|
2012-10-20 14:08:49 +00:00
|
|
|
closure/bsdf_diffuse.h
|
2012-12-11 14:39:41 +00:00
|
|
|
closure/bsdf_diffuse_ramp.h
|
2012-10-20 12:18:00 +00:00
|
|
|
closure/bsdf_microfacet.h
|
Cycles: Add multi-scattering, energy-conserving GGX as an option to the Glossy, Anisotropic and Glass BSDFs
This commit adds a new distribution to the Glossy, Anisotropic and Glass BSDFs that implements the
multiple-scattering microfacet model described in the paper "Multiple-Scattering Microfacet BSDFs with the Smith Model".
Essentially, the improvement is that unlike classical GGX, which only models single scattering and assumes
the contribution of multiple bounces to be zero, this new model performs a random walk on the microsurface until
the ray leaves it again, which ensures perfect energy conservation.
In practise, this means that the "darkening problem" - GGX materials becoming darker with increasing
roughness - is solved in a physically correct and efficient way.
The downside of this model is that it has no (known) analytic expression for evalation. However, it can be
evaluated stochastically, and although the correct PDF isn't known either, the properties of MIS and the
balance heuristic guarantee an unbiased result at the cost of slightly higher noise.
Reviewers: dingto, #cycles, brecht
Reviewed By: dingto, #cycles, brecht
Subscribers: bliblubli, ace_dragon, gregzaal, brecht, harvester, dingto, marcog, swerner, jtheninja, Blendify, nutel
Differential Revision: https://developer.blender.org/D2002
2016-06-23 22:56:43 +02:00
|
|
|
closure/bsdf_microfacet_multi.h
|
|
|
|
closure/bsdf_microfacet_multi_impl.h
|
2012-10-20 14:08:49 +00:00
|
|
|
closure/bsdf_oren_nayar.h
|
2012-11-06 19:59:07 +00:00
|
|
|
closure/bsdf_phong_ramp.h
|
2012-10-20 12:18:00 +00:00
|
|
|
closure/bsdf_reflection.h
|
|
|
|
closure/bsdf_refraction.h
|
2012-12-19 21:17:16 +00:00
|
|
|
closure/bsdf_toon.h
|
2012-10-20 12:18:00 +00:00
|
|
|
closure/bsdf_transparent.h
|
2012-12-15 10:18:42 +00:00
|
|
|
closure/bsdf_util.h
|
2014-06-08 12:16:28 +02:00
|
|
|
closure/bsdf_ashikhmin_shirley.h
|
2013-09-15 23:58:00 +00:00
|
|
|
closure/bsdf_hair.h
|
2013-04-01 20:26:52 +00:00
|
|
|
closure/bssrdf.h
|
2012-10-20 12:18:00 +00:00
|
|
|
closure/emissive.h
|
|
|
|
closure/volume.h
|
2017-04-18 11:43:09 +02:00
|
|
|
closure/bsdf_principled_diffuse.h
|
|
|
|
closure/bsdf_principled_sheen.h
|
2019-09-12 14:50:06 +02:00
|
|
|
closure/bsdf_hair_principled.h
|
2012-10-20 14:08:49 +00:00
|
|
|
)
|
Cycles: OpenCL kernel split
This commit contains all the work related on the AMD megakernel split work
which was mainly done by Varun Sundar, George Kyriazis and Lenny Wang, plus
some help from Sergey Sharybin, Martijn Berger, Thomas Dinges and likely
someone else which we're forgetting to mention.
Currently only AMD cards are enabled for the new split kernel, but it is
possible to force split opencl kernel to be used by setting the following
environment variable: CYCLES_OPENCL_SPLIT_KERNEL_TEST=1.
Not all the features are supported yet, and that being said no motion blur,
camera blur, SSS and volumetrics for now. Also transparent shadows are
disabled on AMD device because of some compiler bug.
This kernel is also only implements regular path tracing and supporting
branched one will take a bit. Branched path tracing is exposed to the
interface still, which is a bit misleading and will be hidden there soon.
More feature will be enabled once they're ported to the split kernel and
tested.
Neither regular CPU nor CUDA has any difference, they're generating the
same exact code, which means no regressions/improvements there.
Based on the research paper:
https://research.nvidia.com/sites/default/files/publications/laine2013hpg_paper.pdf
Here's the documentation:
https://docs.google.com/document/d/1LuXW-CV-sVJkQaEGZlMJ86jZ8FmoPfecaMdR-oiWbUY/edit
Design discussion of the patch:
https://developer.blender.org/T44197
Differential Revision: https://developer.blender.org/D1200
2015-05-09 19:34:30 +05:00
|
|
|
|
2021-10-26 16:13:39 +02:00
|
|
|
set(SRC_KERNEL_SVM_HEADERS
|
2011-04-27 11:58:34 +00:00
|
|
|
svm/svm.h
|
2021-10-24 14:19:19 +02:00
|
|
|
svm/ao.h
|
|
|
|
svm/aov.h
|
|
|
|
svm/attribute.h
|
|
|
|
svm/bevel.h
|
|
|
|
svm/blackbody.h
|
|
|
|
svm/bump.h
|
|
|
|
svm/camera.h
|
|
|
|
svm/clamp.h
|
|
|
|
svm/closure.h
|
|
|
|
svm/convert.h
|
|
|
|
svm/checker.h
|
|
|
|
svm/color_util.h
|
|
|
|
svm/brick.h
|
|
|
|
svm/displace.h
|
|
|
|
svm/fresnel.h
|
|
|
|
svm/wireframe.h
|
|
|
|
svm/wavelength.h
|
|
|
|
svm/gamma.h
|
|
|
|
svm/brightness.h
|
|
|
|
svm/geometry.h
|
|
|
|
svm/gradient.h
|
|
|
|
svm/hsv.h
|
|
|
|
svm/ies.h
|
|
|
|
svm/image.h
|
|
|
|
svm/invert.h
|
|
|
|
svm/light_path.h
|
|
|
|
svm/magic.h
|
|
|
|
svm/map_range.h
|
|
|
|
svm/mapping.h
|
|
|
|
svm/mapping_util.h
|
|
|
|
svm/math.h
|
|
|
|
svm/math_util.h
|
|
|
|
svm/mix.h
|
|
|
|
svm/musgrave.h
|
|
|
|
svm/noise.h
|
|
|
|
svm/noisetex.h
|
|
|
|
svm/normal.h
|
|
|
|
svm/ramp.h
|
|
|
|
svm/ramp_util.h
|
|
|
|
svm/sepcomb_hsv.h
|
|
|
|
svm/sepcomb_vector.h
|
|
|
|
svm/sky.h
|
|
|
|
svm/tex_coord.h
|
|
|
|
svm/fractal_noise.h
|
|
|
|
svm/types.h
|
|
|
|
svm/value.h
|
|
|
|
svm/vector_rotate.h
|
|
|
|
svm/vector_transform.h
|
|
|
|
svm/voronoi.h
|
|
|
|
svm/voxel.h
|
|
|
|
svm/wave.h
|
|
|
|
svm/white_noise.h
|
|
|
|
svm/vertex_color.h
|
2011-11-08 20:27:37 +00:00
|
|
|
)
|
2011-04-27 11:58:34 +00:00
|
|
|
|
2021-10-26 16:13:39 +02:00
|
|
|
set(SRC_KERNEL_GEOM_HEADERS
|
2014-03-29 13:03:48 +01:00
|
|
|
geom/geom.h
|
2021-10-24 14:19:19 +02:00
|
|
|
geom/attribute.h
|
|
|
|
geom/curve.h
|
|
|
|
geom/curve_intersect.h
|
|
|
|
geom/motion_curve.h
|
2021-12-01 17:30:46 +01:00
|
|
|
geom/motion_point.h
|
2021-10-24 14:19:19 +02:00
|
|
|
geom/motion_triangle.h
|
|
|
|
geom/motion_triangle_intersect.h
|
|
|
|
geom/motion_triangle_shader.h
|
|
|
|
geom/object.h
|
|
|
|
geom/patch.h
|
2021-12-01 17:30:46 +01:00
|
|
|
geom/point.h
|
|
|
|
geom/point_intersect.h
|
2021-10-24 14:19:19 +02:00
|
|
|
geom/primitive.h
|
|
|
|
geom/shader_data.h
|
|
|
|
geom/subd_triangle.h
|
|
|
|
geom/triangle.h
|
|
|
|
geom/triangle_intersect.h
|
|
|
|
geom/volume.h
|
2014-03-29 13:03:45 +01:00
|
|
|
)
|
|
|
|
|
2021-10-26 16:13:39 +02:00
|
|
|
set(SRC_KERNEL_BAKE_HEADERS
|
|
|
|
bake/bake.h
|
|
|
|
)
|
|
|
|
|
|
|
|
set(SRC_KERNEL_BVH_HEADERS
|
|
|
|
bvh/bvh.h
|
|
|
|
bvh/nodes.h
|
|
|
|
bvh/shadow_all.h
|
|
|
|
bvh/local.h
|
|
|
|
bvh/traversal.h
|
|
|
|
bvh/types.h
|
|
|
|
bvh/util.h
|
|
|
|
bvh/volume.h
|
|
|
|
bvh/volume_all.h
|
|
|
|
bvh/embree.h
|
2021-11-29 15:06:22 +00:00
|
|
|
bvh/metal.h
|
2021-10-26 16:13:39 +02:00
|
|
|
)
|
|
|
|
|
|
|
|
set(SRC_KERNEL_CAMERA_HEADERS
|
|
|
|
camera/camera.h
|
|
|
|
camera/projection.h
|
|
|
|
)
|
|
|
|
|
|
|
|
set(SRC_KERNEL_FILM_HEADERS
|
|
|
|
film/accumulate.h
|
|
|
|
film/adaptive_sampling.h
|
|
|
|
film/id_passes.h
|
|
|
|
film/passes.h
|
|
|
|
film/read.h
|
|
|
|
film/write_passes.h
|
|
|
|
)
|
|
|
|
|
|
|
|
set(SRC_KERNEL_INTEGRATOR_HEADERS
|
2021-10-24 14:19:19 +02:00
|
|
|
integrator/init_from_bake.h
|
|
|
|
integrator/init_from_camera.h
|
|
|
|
integrator/intersect_closest.h
|
|
|
|
integrator/intersect_shadow.h
|
|
|
|
integrator/intersect_subsurface.h
|
|
|
|
integrator/intersect_volume_stack.h
|
|
|
|
integrator/megakernel.h
|
2021-10-26 16:13:39 +02:00
|
|
|
integrator/path_state.h
|
2021-10-24 14:19:19 +02:00
|
|
|
integrator/shade_background.h
|
|
|
|
integrator/shade_light.h
|
2021-10-26 16:13:39 +02:00
|
|
|
integrator/shader_eval.h
|
2021-10-24 14:19:19 +02:00
|
|
|
integrator/shade_shadow.h
|
|
|
|
integrator/shade_surface.h
|
|
|
|
integrator/shade_volume.h
|
2021-10-26 16:13:39 +02:00
|
|
|
integrator/shadow_catcher.h
|
2021-10-24 14:19:19 +02:00
|
|
|
integrator/shadow_state_template.h
|
|
|
|
integrator/state_flow.h
|
2021-10-26 16:13:39 +02:00
|
|
|
integrator/state.h
|
2021-10-24 14:19:19 +02:00
|
|
|
integrator/state_template.h
|
|
|
|
integrator/state_util.h
|
|
|
|
integrator/subsurface_disk.h
|
2021-10-26 16:13:39 +02:00
|
|
|
integrator/subsurface.h
|
2021-10-24 14:19:19 +02:00
|
|
|
integrator/subsurface_random_walk.h
|
|
|
|
integrator/volume_stack.h
|
2017-05-07 14:40:58 +02:00
|
|
|
)
|
|
|
|
|
2021-10-26 16:13:39 +02:00
|
|
|
set(SRC_KERNEL_LIGHT_HEADERS
|
|
|
|
light/light.h
|
|
|
|
light/background.h
|
|
|
|
light/common.h
|
|
|
|
light/sample.h
|
|
|
|
)
|
|
|
|
|
|
|
|
set(SRC_KERNEL_SAMPLE_HEADERS
|
|
|
|
sample/jitter.h
|
|
|
|
sample/lcg.h
|
|
|
|
sample/mapping.h
|
|
|
|
sample/mis.h
|
|
|
|
sample/pattern.h
|
|
|
|
)
|
|
|
|
|
|
|
|
set(SRC_KERNEL_UTIL_HEADERS
|
|
|
|
util/color.h
|
|
|
|
util/differential.h
|
|
|
|
util/lookup_table.h
|
|
|
|
util/profiling.h
|
|
|
|
)
|
|
|
|
|
|
|
|
set(SRC_KERNEL_TYPES_HEADERS
|
2021-11-18 14:25:30 +01:00
|
|
|
tables.h
|
2021-10-26 16:13:39 +02:00
|
|
|
textures.h
|
|
|
|
types.h
|
|
|
|
)
|
|
|
|
|
|
|
|
set(SRC_KERNEL_HEADERS
|
|
|
|
${SRC_KERNEL_BAKE_HEADERS}
|
|
|
|
${SRC_KERNEL_BVH_HEADERS}
|
|
|
|
${SRC_KERNEL_CAMERA_HEADERS}
|
|
|
|
${SRC_KERNEL_CLOSURE_HEADERS}
|
|
|
|
${SRC_KERNEL_FILM_HEADERS}
|
|
|
|
${SRC_KERNEL_GEOM_HEADERS}
|
|
|
|
${SRC_KERNEL_INTEGRATOR_HEADERS}
|
|
|
|
${SRC_KERNEL_LIGHT_HEADERS}
|
|
|
|
${SRC_KERNEL_SAMPLE_HEADERS}
|
|
|
|
${SRC_KERNEL_SVM_HEADERS}
|
|
|
|
${SRC_KERNEL_TYPES_HEADERS}
|
|
|
|
${SRC_KERNEL_UTIL_HEADERS}
|
|
|
|
)
|
|
|
|
|
2011-11-08 20:27:37 +00:00
|
|
|
set(SRC_UTIL_HEADERS
|
2021-10-24 14:19:19 +02:00
|
|
|
../util/atomic.h
|
|
|
|
../util/color.h
|
|
|
|
../util/defines.h
|
|
|
|
../util/half.h
|
|
|
|
../util/hash.h
|
|
|
|
../util/math.h
|
|
|
|
../util/math_fast.h
|
|
|
|
../util/math_intersect.h
|
|
|
|
../util/math_float2.h
|
|
|
|
../util/math_float3.h
|
|
|
|
../util/math_float4.h
|
|
|
|
../util/math_int2.h
|
|
|
|
../util/math_int3.h
|
|
|
|
../util/math_int4.h
|
|
|
|
../util/math_matrix.h
|
|
|
|
../util/projection.h
|
|
|
|
../util/rect.h
|
|
|
|
../util/static_assert.h
|
|
|
|
../util/transform.h
|
|
|
|
../util/texture.h
|
|
|
|
../util/types.h
|
|
|
|
../util/types_float2.h
|
|
|
|
../util/types_float2_impl.h
|
|
|
|
../util/types_float3.h
|
|
|
|
../util/types_float3_impl.h
|
|
|
|
../util/types_float4.h
|
|
|
|
../util/types_float4_impl.h
|
|
|
|
../util/types_float8.h
|
|
|
|
../util/types_float8_impl.h
|
|
|
|
../util/types_int2.h
|
|
|
|
../util/types_int2_impl.h
|
|
|
|
../util/types_int3.h
|
|
|
|
../util/types_int3_impl.h
|
|
|
|
../util/types_int4.h
|
|
|
|
../util/types_int4_impl.h
|
|
|
|
../util/types_uchar2.h
|
|
|
|
../util/types_uchar2_impl.h
|
|
|
|
../util/types_uchar3.h
|
|
|
|
../util/types_uchar3_impl.h
|
|
|
|
../util/types_uchar4.h
|
|
|
|
../util/types_uchar4_impl.h
|
|
|
|
../util/types_uint2.h
|
|
|
|
../util/types_uint2_impl.h
|
|
|
|
../util/types_uint3.h
|
|
|
|
../util/types_uint3_impl.h
|
|
|
|
../util/types_uint4.h
|
|
|
|
../util/types_uint4_impl.h
|
|
|
|
../util/types_ushort4.h
|
|
|
|
../util/types_vector3.h
|
|
|
|
../util/types_vector3_impl.h
|
2011-11-08 20:27:37 +00:00
|
|
|
)
|
2015-05-21 17:40:04 +05:00
|
|
|
|
2019-04-16 06:11:27 +02:00
|
|
|
set(LIB
|
|
|
|
|
|
|
|
)
|
|
|
|
|
2011-11-10 12:52:17 +00:00
|
|
|
# CUDA module
|
|
|
|
|
|
|
|
if(WITH_CYCLES_CUDA_BINARIES)
|
2018-02-17 16:15:07 +01:00
|
|
|
# 64 bit only
|
|
|
|
set(CUDA_BITS 64)
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2013-06-19 17:54:23 +00:00
|
|
|
# CUDA version
|
2015-06-30 22:44:27 +10:00
|
|
|
execute_process(COMMAND ${CUDA_NVCC_EXECUTABLE} "--version" OUTPUT_VARIABLE NVCC_OUT)
|
2016-05-09 16:05:02 +02:00
|
|
|
string(REGEX REPLACE ".*release ([0-9]+)\\.([0-9]+).*" "\\1" CUDA_VERSION_MAJOR "${NVCC_OUT}")
|
|
|
|
string(REGEX REPLACE ".*release ([0-9]+)\\.([0-9]+).*" "\\2" CUDA_VERSION_MINOR "${NVCC_OUT}")
|
2013-06-19 17:54:23 +00:00
|
|
|
set(CUDA_VERSION "${CUDA_VERSION_MAJOR}${CUDA_VERSION_MINOR}")
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2013-06-20 13:10:47 +00:00
|
|
|
# warn for other versions
|
2021-07-26 19:45:05 +02:00
|
|
|
if((CUDA_VERSION MATCHES "101") OR
|
|
|
|
(CUDA_VERSION MATCHES "102") OR
|
|
|
|
(CUDA_VERSION MATCHES "111") OR
|
|
|
|
(CUDA_VERSION MATCHES "112") OR
|
|
|
|
(CUDA_VERSION MATCHES "113") OR
|
|
|
|
(CUDA_VERSION MATCHES "114"))
|
2013-06-20 13:10:47 +00:00
|
|
|
else()
|
2014-03-13 23:31:06 +11:00
|
|
|
message(WARNING
|
|
|
|
"CUDA version ${CUDA_VERSION_MAJOR}.${CUDA_VERSION_MINOR} detected, "
|
2021-07-26 19:45:05 +02:00
|
|
|
"build may succeed but only CUDA 10.1 to 11.4 are officially supported")
|
2013-06-20 13:10:47 +00:00
|
|
|
endif()
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2013-06-19 17:54:23 +00:00
|
|
|
# build for each arch
|
Cycles: merge of cycles-x branch, a major update to the renderer
This includes much improved GPU rendering performance, viewport interactivity,
new shadow catcher, revamped sampling settings, subsurface scattering anisotropy,
new GPU volume sampling, improved PMJ sampling pattern, and more.
Some features have also been removed or changed, breaking backwards compatibility.
Including the removal of the OpenCL backend, for which alternatives are under
development.
Release notes and code docs:
https://wiki.blender.org/wiki/Reference/Release_Notes/3.0/Cycles
https://wiki.blender.org/wiki/Source/Render/Cycles
Credits:
* Sergey Sharybin
* Brecht Van Lommel
* Patrick Mours (OptiX backend)
* Christophe Hery (subsurface scattering anisotropy)
* William Leeson (PMJ sampling pattern)
* Alaska (various fixes and tweaks)
* Thomas Dinges (various fixes)
For the full commit history, see the cycles-x branch. This squashes together
all the changes since intermediate changes would often fail building or tests.
Ref T87839, T87837, T87836
Fixes T90734, T89353, T80267, T80267, T77185, T69800
2021-09-20 17:59:20 +02:00
|
|
|
set(cuda_sources device/cuda/kernel.cu
|
2021-10-26 16:13:39 +02:00
|
|
|
${SRC_KERNEL_HEADERS}
|
|
|
|
${SRC_KERNEL_DEVICE_GPU_HEADERS}
|
|
|
|
${SRC_KERNEL_DEVICE_CUDA_HEADERS}
|
2016-07-11 12:28:45 +02:00
|
|
|
${SRC_UTIL_HEADERS}
|
|
|
|
)
|
2011-11-10 12:52:17 +00:00
|
|
|
set(cuda_cubins)
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2018-08-20 01:17:34 -07:00
|
|
|
macro(CYCLES_CUDA_KERNEL_ADD arch prev_arch name flags sources experimental)
|
2019-10-16 10:29:04 +02:00
|
|
|
if(${arch} MATCHES "compute_.*")
|
|
|
|
set(format "ptx")
|
|
|
|
else()
|
|
|
|
set(format "cubin")
|
|
|
|
endif()
|
|
|
|
set(cuda_file ${name}_${arch}.${format})
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2018-08-20 01:17:34 -07:00
|
|
|
set(kernel_sources ${sources})
|
|
|
|
if(NOT ${prev_arch} STREQUAL "none")
|
2019-10-16 10:29:04 +02:00
|
|
|
if(${prev_arch} MATCHES "compute_.*")
|
|
|
|
set(kernel_sources ${kernel_sources} ${name}_${prev_arch}.ptx)
|
|
|
|
else()
|
|
|
|
set(kernel_sources ${kernel_sources} ${name}_${prev_arch}.cubin)
|
|
|
|
endif()
|
2018-08-20 01:17:34 -07:00
|
|
|
endif()
|
2019-04-17 06:17:24 +02:00
|
|
|
|
Cycles: merge of cycles-x branch, a major update to the renderer
This includes much improved GPU rendering performance, viewport interactivity,
new shadow catcher, revamped sampling settings, subsurface scattering anisotropy,
new GPU volume sampling, improved PMJ sampling pattern, and more.
Some features have also been removed or changed, breaking backwards compatibility.
Including the removal of the OpenCL backend, for which alternatives are under
development.
Release notes and code docs:
https://wiki.blender.org/wiki/Reference/Release_Notes/3.0/Cycles
https://wiki.blender.org/wiki/Source/Render/Cycles
Credits:
* Sergey Sharybin
* Brecht Van Lommel
* Patrick Mours (OptiX backend)
* Christophe Hery (subsurface scattering anisotropy)
* William Leeson (PMJ sampling pattern)
* Alaska (various fixes and tweaks)
* Thomas Dinges (various fixes)
For the full commit history, see the cycles-x branch. This squashes together
all the changes since intermediate changes would often fail building or tests.
Ref T87839, T87837, T87836
Fixes T90734, T89353, T80267, T80267, T77185, T69800
2021-09-20 17:59:20 +02:00
|
|
|
set(cuda_kernel_src "/device/cuda/${name}.cu")
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2020-12-03 12:19:36 +01:00
|
|
|
set(cuda_flags ${flags}
|
2018-02-03 10:59:09 -07:00
|
|
|
-D CCL_NAMESPACE_BEGIN=
|
|
|
|
-D CCL_NAMESPACE_END=
|
|
|
|
-D NVCC
|
|
|
|
-m ${CUDA_BITS}
|
|
|
|
-I ${CMAKE_CURRENT_SOURCE_DIR}/..
|
Cycles: merge of cycles-x branch, a major update to the renderer
This includes much improved GPU rendering performance, viewport interactivity,
new shadow catcher, revamped sampling settings, subsurface scattering anisotropy,
new GPU volume sampling, improved PMJ sampling pattern, and more.
Some features have also been removed or changed, breaking backwards compatibility.
Including the removal of the OpenCL backend, for which alternatives are under
development.
Release notes and code docs:
https://wiki.blender.org/wiki/Reference/Release_Notes/3.0/Cycles
https://wiki.blender.org/wiki/Source/Render/Cycles
Credits:
* Sergey Sharybin
* Brecht Van Lommel
* Patrick Mours (OptiX backend)
* Christophe Hery (subsurface scattering anisotropy)
* William Leeson (PMJ sampling pattern)
* Alaska (various fixes and tweaks)
* Thomas Dinges (various fixes)
For the full commit history, see the cycles-x branch. This squashes together
all the changes since intermediate changes would often fail building or tests.
Ref T87839, T87837, T87836
Fixes T90734, T89353, T80267, T80267, T77185, T69800
2021-09-20 17:59:20 +02:00
|
|
|
-I ${CMAKE_CURRENT_SOURCE_DIR}/device/cuda
|
2018-02-03 10:59:09 -07:00
|
|
|
--use_fast_math
|
2021-11-17 18:46:21 +01:00
|
|
|
-o ${CMAKE_CURRENT_BINARY_DIR}/${cuda_file}
|
|
|
|
-Wno-deprecated-gpu-targets)
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2020-10-02 17:40:28 +02:00
|
|
|
if(WITH_NANOVDB)
|
|
|
|
set(cuda_flags ${cuda_flags}
|
|
|
|
-D WITH_NANOVDB
|
|
|
|
-I "${NANOVDB_INCLUDE_DIR}")
|
|
|
|
endif()
|
|
|
|
|
2021-11-17 17:26:46 +01:00
|
|
|
if(WITH_CYCLES_DEBUG)
|
|
|
|
set(cuda_flags ${cuda_flags} -D WITH_CYCLES_DEBUG)
|
|
|
|
endif()
|
|
|
|
|
2019-03-15 14:18:22 +01:00
|
|
|
if(WITH_CYCLES_CUBIN_COMPILER)
|
2018-02-03 10:59:09 -07:00
|
|
|
string(SUBSTRING ${arch} 3 -1 CUDA_ARCH)
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2018-02-03 10:59:09 -07:00
|
|
|
# Needed to find libnvrtc-builtins.so. Can't do it from inside
|
|
|
|
# cycles_cubin_cc since the env variable is read before main()
|
|
|
|
if(APPLE)
|
|
|
|
set(CUBIN_CC_ENV ${CMAKE_COMMAND}
|
2020-10-13 12:33:34 +02:00
|
|
|
-E env DYLD_LIBRARY_PATH="${cuda_toolkit_root_dir}/lib")
|
2018-02-03 10:59:09 -07:00
|
|
|
elseif(UNIX)
|
|
|
|
set(CUBIN_CC_ENV ${CMAKE_COMMAND}
|
2020-10-13 12:33:34 +02:00
|
|
|
-E env LD_LIBRARY_PATH="${cuda_toolkit_root_dir}/lib64")
|
2018-02-03 10:59:09 -07:00
|
|
|
endif()
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2018-02-03 10:59:09 -07:00
|
|
|
add_custom_command(
|
2020-03-26 11:41:44 -06:00
|
|
|
OUTPUT ${cuda_file}
|
2018-02-03 10:59:09 -07:00
|
|
|
COMMAND ${CUBIN_CC_ENV}
|
|
|
|
"$<TARGET_FILE:cycles_cubin_cc>"
|
|
|
|
-target ${CUDA_ARCH}
|
|
|
|
-i ${CMAKE_CURRENT_SOURCE_DIR}${cuda_kernel_src}
|
|
|
|
${cuda_flags}
|
|
|
|
-v
|
2020-10-13 12:33:34 +02:00
|
|
|
-cuda-toolkit-dir "${cuda_toolkit_root_dir}"
|
2018-08-20 01:17:34 -07:00
|
|
|
DEPENDS ${kernel_sources} cycles_cubin_cc)
|
2018-02-03 10:59:09 -07:00
|
|
|
else()
|
2021-10-05 14:53:27 +02:00
|
|
|
set(_cuda_nvcc_args
|
2018-02-03 10:59:09 -07:00
|
|
|
-arch=${arch}
|
|
|
|
${CUDA_NVCC_FLAGS}
|
2019-10-16 10:29:04 +02:00
|
|
|
--${format}
|
2018-02-03 10:59:09 -07:00
|
|
|
${CMAKE_CURRENT_SOURCE_DIR}${cuda_kernel_src}
|
|
|
|
--ptxas-options="-v"
|
2021-10-05 14:53:27 +02:00
|
|
|
${cuda_flags})
|
|
|
|
|
|
|
|
if(WITH_COMPILER_CCACHE AND CCACHE_PROGRAM)
|
|
|
|
add_custom_command(
|
|
|
|
OUTPUT ${cuda_file}
|
|
|
|
COMMAND ${CCACHE_PROGRAM} ${cuda_nvcc_executable} ${_cuda_nvcc_args}
|
|
|
|
DEPENDS ${kernel_sources})
|
|
|
|
else()
|
|
|
|
add_custom_command(
|
|
|
|
OUTPUT ${cuda_file}
|
|
|
|
COMMAND ${cuda_nvcc_executable} ${_cuda_nvcc_args}
|
|
|
|
DEPENDS ${kernel_sources})
|
|
|
|
endif()
|
|
|
|
|
|
|
|
unset(_cuda_nvcc_args)
|
2018-02-03 10:59:09 -07:00
|
|
|
endif()
|
2019-10-16 10:29:04 +02:00
|
|
|
delayed_install("${CMAKE_CURRENT_BINARY_DIR}" "${cuda_file}" ${CYCLES_INSTALL_PATH}/lib)
|
|
|
|
list(APPEND cuda_cubins ${cuda_file})
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2014-10-05 21:42:04 +06:00
|
|
|
unset(cuda_debug_flags)
|
2014-08-26 17:02:03 +02:00
|
|
|
endmacro()
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2018-08-20 01:17:34 -07:00
|
|
|
set(prev_arch "none")
|
2014-08-26 17:02:03 +02:00
|
|
|
foreach(arch ${CYCLES_CUDA_BINARIES_ARCH})
|
2020-10-13 12:33:34 +02:00
|
|
|
if(${arch} MATCHES ".*_2.")
|
2018-02-06 15:19:25 +01:00
|
|
|
message(STATUS "CUDA binaries for ${arch} are no longer supported, skipped.")
|
2020-10-13 12:33:34 +02:00
|
|
|
elseif(${arch} MATCHES ".*_30")
|
|
|
|
if(DEFINED CUDA10_NVCC_EXECUTABLE)
|
|
|
|
set(cuda_nvcc_executable ${CUDA10_NVCC_EXECUTABLE})
|
|
|
|
set(cuda_toolkit_root_dir ${CUDA10_TOOLKIT_ROOT_DIR})
|
|
|
|
elseif(${CUDA_VERSION} LESS 110) # Support for sm_30 was removed in CUDA 11
|
|
|
|
set(cuda_nvcc_executable ${CUDA_NVCC_EXECUTABLE})
|
|
|
|
set(cuda_toolkit_root_dir ${CUDA_TOOLKIT_ROOT_DIR})
|
|
|
|
else()
|
|
|
|
message(STATUS "CUDA binaries for ${arch} require CUDA 10 or earlier, skipped.")
|
|
|
|
endif()
|
|
|
|
elseif(${arch} MATCHES ".*_7." AND ${CUDA_VERSION} LESS 100)
|
2018-12-04 12:34:59 +01:00
|
|
|
message(STATUS "CUDA binaries for ${arch} require CUDA 10.0+, skipped.")
|
2020-10-13 12:33:34 +02:00
|
|
|
elseif(${arch} MATCHES ".*_8.")
|
|
|
|
if(DEFINED CUDA11_NVCC_EXECUTABLE)
|
|
|
|
set(cuda_nvcc_executable ${CUDA11_NVCC_EXECUTABLE})
|
|
|
|
set(cuda_toolkit_root_dir ${CUDA11_TOOLKIT_ROOT_DIR})
|
|
|
|
elseif(${CUDA_VERSION} GREATER_EQUAL 111) # Support for sm_86 was introduced in CUDA 11
|
|
|
|
set(cuda_nvcc_executable ${CUDA_NVCC_EXECUTABLE})
|
|
|
|
set(cuda_toolkit_root_dir ${CUDA_TOOLKIT_ROOT_DIR})
|
|
|
|
else()
|
|
|
|
message(STATUS "CUDA binaries for ${arch} require CUDA 11.1+, skipped.")
|
|
|
|
endif()
|
2018-02-06 15:19:25 +01:00
|
|
|
else()
|
2020-10-13 12:33:34 +02:00
|
|
|
set(cuda_nvcc_executable ${CUDA_NVCC_EXECUTABLE})
|
|
|
|
set(cuda_toolkit_root_dir ${CUDA_TOOLKIT_ROOT_DIR})
|
|
|
|
endif()
|
|
|
|
if(DEFINED cuda_nvcc_executable AND DEFINED cuda_toolkit_root_dir)
|
2018-02-06 15:19:25 +01:00
|
|
|
# Compile regular kernel
|
2018-08-20 01:17:34 -07:00
|
|
|
CYCLES_CUDA_KERNEL_ADD(${arch} ${prev_arch} kernel "" "${cuda_sources}" FALSE)
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2018-08-20 01:17:34 -07:00
|
|
|
if(WITH_CYCLES_CUDA_BUILD_SERIAL)
|
|
|
|
set(prev_arch ${arch})
|
|
|
|
endif()
|
2020-10-13 12:33:34 +02:00
|
|
|
|
|
|
|
unset(cuda_nvcc_executable)
|
|
|
|
unset(cuda_toolkit_root_dir)
|
2017-02-14 05:50:29 -05:00
|
|
|
endif()
|
2011-11-10 12:52:17 +00:00
|
|
|
endforeach()
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2011-11-10 12:52:17 +00:00
|
|
|
add_custom_target(cycles_kernel_cuda ALL DEPENDS ${cuda_cubins})
|
2018-02-03 16:38:27 -07:00
|
|
|
cycles_set_solution_folder(cycles_kernel_cuda)
|
2011-11-10 12:52:17 +00:00
|
|
|
endif()
|
2011-08-11 12:36:08 +00:00
|
|
|
|
2021-09-28 16:51:14 +02:00
|
|
|
####################################################### START
|
|
|
|
|
|
|
|
# HIP module
|
|
|
|
|
2021-10-05 13:08:44 +02:00
|
|
|
if(WITH_CYCLES_HIP_BINARIES AND WITH_CYCLES_DEVICE_HIP)
|
2021-09-28 16:51:14 +02:00
|
|
|
# build for each arch
|
|
|
|
set(hip_sources device/hip/kernel.cpp
|
2021-10-26 16:13:39 +02:00
|
|
|
${SRC_KERNEL_HEADERS}
|
|
|
|
${SRC_KERNEL_DEVICE_GPU_HEADERS}
|
|
|
|
${SRC_KERNEL_DEVICE_HIP_HEADERS}
|
2021-09-28 16:51:14 +02:00
|
|
|
${SRC_UTIL_HEADERS}
|
|
|
|
)
|
|
|
|
set(hip_fatbins)
|
|
|
|
|
2021-10-22 14:14:03 +02:00
|
|
|
macro(CYCLES_HIP_KERNEL_ADD arch name flags sources experimental)
|
2021-10-21 20:57:17 +02:00
|
|
|
set(format "fatbin")
|
2021-09-28 16:51:14 +02:00
|
|
|
set(hip_file ${name}_${arch}.${format})
|
|
|
|
set(kernel_sources ${sources})
|
|
|
|
|
|
|
|
set(hip_kernel_src "/device/hip/${name}.cpp")
|
|
|
|
|
2021-10-21 20:57:17 +02:00
|
|
|
if(WIN32)
|
|
|
|
set(hip_command ${CMAKE_COMMAND})
|
|
|
|
set(hip_flags
|
2021-10-22 14:14:03 +02:00
|
|
|
-E env "HIP_PATH=${HIP_ROOT_DIR}" "PATH=${HIP_PERL_DIR}"
|
2021-10-21 20:57:17 +02:00
|
|
|
${HIP_HIPCC_EXECUTABLE}.bat)
|
|
|
|
else()
|
|
|
|
set(hip_command ${HIP_HIPCC_EXECUTABLE})
|
|
|
|
set(hip_flags)
|
|
|
|
endif()
|
|
|
|
|
|
|
|
set(hip_flags
|
|
|
|
${hip_flags}
|
|
|
|
--amdgpu-target=${arch}
|
|
|
|
${HIP_HIPCC_FLAGS}
|
|
|
|
--genco
|
|
|
|
${CMAKE_CURRENT_SOURCE_DIR}${hip_kernel_src}
|
|
|
|
${flags}
|
2021-09-28 16:51:14 +02:00
|
|
|
-D CCL_NAMESPACE_BEGIN=
|
|
|
|
-D CCL_NAMESPACE_END=
|
|
|
|
-D HIPCC
|
|
|
|
-I ${CMAKE_CURRENT_SOURCE_DIR}/..
|
|
|
|
-I ${CMAKE_CURRENT_SOURCE_DIR}/device/hip
|
2021-10-21 20:57:17 +02:00
|
|
|
-Wno-parentheses-equality
|
|
|
|
-Wno-unused-value
|
|
|
|
--hipcc-func-supp
|
|
|
|
-ffast-math
|
2021-09-28 16:51:14 +02:00
|
|
|
-o ${CMAKE_CURRENT_BINARY_DIR}/${hip_file})
|
|
|
|
|
2021-11-18 00:41:04 +01:00
|
|
|
if(WITH_NANOVDB)
|
|
|
|
set(hip_flags ${hip_flags}
|
|
|
|
-D WITH_NANOVDB
|
|
|
|
-I "${NANOVDB_INCLUDE_DIR}")
|
|
|
|
endif()
|
|
|
|
|
2021-09-28 16:51:14 +02:00
|
|
|
if(WITH_CYCLES_DEBUG)
|
2021-11-17 17:26:46 +01:00
|
|
|
set(hip_flags ${hip_flags} -D WITH_CYCLES_DEBUG)
|
2021-09-28 16:51:14 +02:00
|
|
|
endif()
|
|
|
|
|
2021-10-22 14:14:03 +02:00
|
|
|
add_custom_command(
|
|
|
|
OUTPUT ${hip_file}
|
2021-10-21 20:57:17 +02:00
|
|
|
COMMAND ${hip_command} ${hip_flags}
|
2021-10-05 13:08:44 +02:00
|
|
|
DEPENDS ${kernel_sources})
|
|
|
|
delayed_install("${CMAKE_CURRENT_BINARY_DIR}" "${hip_file}" ${CYCLES_INSTALL_PATH}/lib)
|
|
|
|
list(APPEND hip_fatbins ${hip_file})
|
2021-09-28 19:55:25 +02:00
|
|
|
endmacro()
|
2021-09-28 16:51:14 +02:00
|
|
|
|
|
|
|
foreach(arch ${CYCLES_HIP_BINARIES_ARCH})
|
2021-10-05 13:08:44 +02:00
|
|
|
# Compile regular kernel
|
2021-10-22 14:14:03 +02:00
|
|
|
CYCLES_HIP_KERNEL_ADD(${arch} kernel "" "${hip_sources}" FALSE)
|
2021-09-28 16:51:14 +02:00
|
|
|
endforeach()
|
|
|
|
|
|
|
|
add_custom_target(cycles_kernel_hip ALL DEPENDS ${hip_fatbins})
|
|
|
|
cycles_set_solution_folder(cycles_kernel_hip)
|
|
|
|
endif()
|
|
|
|
|
|
|
|
####################################################### END
|
2019-09-12 14:50:06 +02:00
|
|
|
# OptiX PTX modules
|
|
|
|
|
2020-04-11 12:59:21 -06:00
|
|
|
if(WITH_CYCLES_DEVICE_OPTIX AND WITH_CYCLES_CUDA_BINARIES)
|
Cycles: merge of cycles-x branch, a major update to the renderer
This includes much improved GPU rendering performance, viewport interactivity,
new shadow catcher, revamped sampling settings, subsurface scattering anisotropy,
new GPU volume sampling, improved PMJ sampling pattern, and more.
Some features have also been removed or changed, breaking backwards compatibility.
Including the removal of the OpenCL backend, for which alternatives are under
development.
Release notes and code docs:
https://wiki.blender.org/wiki/Reference/Release_Notes/3.0/Cycles
https://wiki.blender.org/wiki/Source/Render/Cycles
Credits:
* Sergey Sharybin
* Brecht Van Lommel
* Patrick Mours (OptiX backend)
* Christophe Hery (subsurface scattering anisotropy)
* William Leeson (PMJ sampling pattern)
* Alaska (various fixes and tweaks)
* Thomas Dinges (various fixes)
For the full commit history, see the cycles-x branch. This squashes together
all the changes since intermediate changes would often fail building or tests.
Ref T87839, T87837, T87836
Fixes T90734, T89353, T80267, T80267, T77185, T69800
2021-09-20 17:59:20 +02:00
|
|
|
macro(CYCLES_OPTIX_KERNEL_ADD name input flags)
|
2020-12-03 12:19:36 +01:00
|
|
|
set(output "${CMAKE_CURRENT_BINARY_DIR}/${name}.ptx")
|
2019-09-12 14:50:06 +02:00
|
|
|
|
2020-12-03 12:19:36 +01:00
|
|
|
set(cuda_flags ${flags}
|
2019-09-12 14:50:06 +02:00
|
|
|
-I "${OPTIX_INCLUDE_DIR}"
|
|
|
|
-I "${CMAKE_CURRENT_SOURCE_DIR}/.."
|
Cycles: merge of cycles-x branch, a major update to the renderer
This includes much improved GPU rendering performance, viewport interactivity,
new shadow catcher, revamped sampling settings, subsurface scattering anisotropy,
new GPU volume sampling, improved PMJ sampling pattern, and more.
Some features have also been removed or changed, breaking backwards compatibility.
Including the removal of the OpenCL backend, for which alternatives are under
development.
Release notes and code docs:
https://wiki.blender.org/wiki/Reference/Release_Notes/3.0/Cycles
https://wiki.blender.org/wiki/Source/Render/Cycles
Credits:
* Sergey Sharybin
* Brecht Van Lommel
* Patrick Mours (OptiX backend)
* Christophe Hery (subsurface scattering anisotropy)
* William Leeson (PMJ sampling pattern)
* Alaska (various fixes and tweaks)
* Thomas Dinges (various fixes)
For the full commit history, see the cycles-x branch. This squashes together
all the changes since intermediate changes would often fail building or tests.
Ref T87839, T87837, T87836
Fixes T90734, T89353, T80267, T80267, T77185, T69800
2021-09-20 17:59:20 +02:00
|
|
|
-I "${CMAKE_CURRENT_SOURCE_DIR}/device/cuda"
|
2019-09-12 14:50:06 +02:00
|
|
|
--use_fast_math
|
Cycles: merge of cycles-x branch, a major update to the renderer
This includes much improved GPU rendering performance, viewport interactivity,
new shadow catcher, revamped sampling settings, subsurface scattering anisotropy,
new GPU volume sampling, improved PMJ sampling pattern, and more.
Some features have also been removed or changed, breaking backwards compatibility.
Including the removal of the OpenCL backend, for which alternatives are under
development.
Release notes and code docs:
https://wiki.blender.org/wiki/Reference/Release_Notes/3.0/Cycles
https://wiki.blender.org/wiki/Source/Render/Cycles
Credits:
* Sergey Sharybin
* Brecht Van Lommel
* Patrick Mours (OptiX backend)
* Christophe Hery (subsurface scattering anisotropy)
* William Leeson (PMJ sampling pattern)
* Alaska (various fixes and tweaks)
* Thomas Dinges (various fixes)
For the full commit history, see the cycles-x branch. This squashes together
all the changes since intermediate changes would often fail building or tests.
Ref T87839, T87837, T87836
Fixes T90734, T89353, T80267, T80267, T77185, T69800
2021-09-20 17:59:20 +02:00
|
|
|
-Wno-deprecated-gpu-targets
|
2019-09-12 14:50:06 +02:00
|
|
|
-o ${output})
|
|
|
|
|
2020-10-02 17:40:28 +02:00
|
|
|
if(WITH_NANOVDB)
|
|
|
|
set(cuda_flags ${cuda_flags}
|
|
|
|
-D WITH_NANOVDB
|
|
|
|
-I "${NANOVDB_INCLUDE_DIR}")
|
|
|
|
endif()
|
|
|
|
|
2021-11-17 17:26:46 +01:00
|
|
|
if(WITH_CYCLES_DEBUG)
|
|
|
|
set(cuda_flags ${cuda_flags} -D WITH_CYCLES_DEBUG)
|
|
|
|
endif()
|
|
|
|
|
2020-10-02 17:40:28 +02:00
|
|
|
if(WITH_CYCLES_CUBIN_COMPILER)
|
2020-03-26 11:41:44 -06:00
|
|
|
# Needed to find libnvrtc-builtins.so. Can't do it from inside
|
|
|
|
# cycles_cubin_cc since the env variable is read before main()
|
|
|
|
if(APPLE)
|
|
|
|
set(CUBIN_CC_ENV ${CMAKE_COMMAND}
|
|
|
|
-E env DYLD_LIBRARY_PATH="${CUDA_TOOLKIT_ROOT_DIR}/lib")
|
|
|
|
elseif(UNIX)
|
|
|
|
set(CUBIN_CC_ENV ${CMAKE_COMMAND}
|
|
|
|
-E env LD_LIBRARY_PATH="${CUDA_TOOLKIT_ROOT_DIR}/lib64")
|
|
|
|
endif()
|
2019-09-12 14:50:06 +02:00
|
|
|
|
2020-03-26 11:41:44 -06:00
|
|
|
add_custom_command(
|
|
|
|
OUTPUT ${output}
|
|
|
|
DEPENDS
|
|
|
|
${input}
|
2021-10-26 16:13:39 +02:00
|
|
|
${SRC_KERNEL_HEADERS}
|
|
|
|
${SRC_KERNEL_DEVICE_GPU_HEADERS}
|
|
|
|
${SRC_KERNEL_DEVICE_CUDA_HEADERS}
|
|
|
|
${SRC_KERNEL_DEVICE_OPTIX_HEADERS}
|
2020-03-26 11:41:44 -06:00
|
|
|
${SRC_UTIL_HEADERS}
|
|
|
|
COMMAND ${CUBIN_CC_ENV}
|
|
|
|
"$<TARGET_FILE:cycles_cubin_cc>"
|
2020-07-27 16:11:00 +02:00
|
|
|
-target 50
|
2020-03-26 11:41:44 -06:00
|
|
|
-ptx
|
|
|
|
-i ${CMAKE_CURRENT_SOURCE_DIR}/${input}
|
|
|
|
${cuda_flags}
|
|
|
|
-v
|
|
|
|
-cuda-toolkit-dir "${CUDA_TOOLKIT_ROOT_DIR}"
|
|
|
|
DEPENDS ${kernel_sources} cycles_cubin_cc)
|
|
|
|
else()
|
|
|
|
add_custom_command(
|
|
|
|
OUTPUT
|
|
|
|
${output}
|
|
|
|
DEPENDS
|
|
|
|
${input}
|
2021-10-26 16:13:39 +02:00
|
|
|
${SRC_KERNEL_HEADERS}
|
|
|
|
${SRC_KERNEL_DEVICE_GPU_HEADERS}
|
|
|
|
${SRC_KERNEL_DEVICE_CUDA_HEADERS}
|
|
|
|
${SRC_KERNEL_DEVICE_OPTIX_HEADERS}
|
2020-03-26 11:41:44 -06:00
|
|
|
${SRC_UTIL_HEADERS}
|
|
|
|
COMMAND
|
|
|
|
${CUDA_NVCC_EXECUTABLE}
|
|
|
|
--ptx
|
2020-07-27 16:11:00 +02:00
|
|
|
-arch=sm_50
|
2020-03-26 11:41:44 -06:00
|
|
|
${cuda_flags}
|
|
|
|
${input}
|
|
|
|
WORKING_DIRECTORY
|
|
|
|
"${CMAKE_CURRENT_SOURCE_DIR}")
|
|
|
|
endif()
|
2019-09-12 14:50:06 +02:00
|
|
|
list(APPEND optix_ptx ${output})
|
|
|
|
|
|
|
|
delayed_install("${CMAKE_CURRENT_BINARY_DIR}" "${output}" ${CYCLES_INSTALL_PATH}/lib)
|
2020-12-03 12:19:36 +01:00
|
|
|
endmacro()
|
|
|
|
|
Cycles: merge of cycles-x branch, a major update to the renderer
This includes much improved GPU rendering performance, viewport interactivity,
new shadow catcher, revamped sampling settings, subsurface scattering anisotropy,
new GPU volume sampling, improved PMJ sampling pattern, and more.
Some features have also been removed or changed, breaking backwards compatibility.
Including the removal of the OpenCL backend, for which alternatives are under
development.
Release notes and code docs:
https://wiki.blender.org/wiki/Reference/Release_Notes/3.0/Cycles
https://wiki.blender.org/wiki/Source/Render/Cycles
Credits:
* Sergey Sharybin
* Brecht Van Lommel
* Patrick Mours (OptiX backend)
* Christophe Hery (subsurface scattering anisotropy)
* William Leeson (PMJ sampling pattern)
* Alaska (various fixes and tweaks)
* Thomas Dinges (various fixes)
For the full commit history, see the cycles-x branch. This squashes together
all the changes since intermediate changes would often fail building or tests.
Ref T87839, T87837, T87836
Fixes T90734, T89353, T80267, T80267, T77185, T69800
2021-09-20 17:59:20 +02:00
|
|
|
CYCLES_OPTIX_KERNEL_ADD(
|
|
|
|
kernel_optix
|
|
|
|
"device/optix/kernel.cu"
|
|
|
|
"")
|
|
|
|
CYCLES_OPTIX_KERNEL_ADD(
|
|
|
|
kernel_optix_shader_raytrace
|
|
|
|
"device/optix/kernel_shader_raytrace.cu"
|
|
|
|
"--keep-device-functions")
|
2019-09-12 14:50:06 +02:00
|
|
|
|
|
|
|
add_custom_target(cycles_kernel_optix ALL DEPENDS ${optix_ptx})
|
|
|
|
cycles_set_solution_folder(cycles_kernel_optix)
|
|
|
|
endif()
|
|
|
|
|
2011-04-27 11:58:34 +00:00
|
|
|
# OSL module
|
|
|
|
|
2011-08-16 16:15:34 +00:00
|
|
|
if(WITH_CYCLES_OSL)
|
2019-04-16 06:18:52 +02:00
|
|
|
list(APPEND LIB
|
|
|
|
cycles_kernel_osl
|
|
|
|
)
|
2011-08-16 16:15:34 +00:00
|
|
|
add_subdirectory(osl)
|
2021-10-24 14:19:19 +02:00
|
|
|
add_subdirectory(osl/shaders)
|
2011-08-16 16:15:34 +00:00
|
|
|
endif()
|
2011-04-27 11:58:34 +00:00
|
|
|
|
|
|
|
# CPU module
|
|
|
|
|
2011-11-08 20:27:37 +00:00
|
|
|
include_directories(${INC})
|
2012-09-20 09:04:43 +00:00
|
|
|
include_directories(SYSTEM ${INC_SYS})
|
2011-04-27 11:58:34 +00:00
|
|
|
|
2019-08-13 06:02:48 +02:00
|
|
|
if(WITH_COMPILER_ASAN)
|
|
|
|
if(CMAKE_COMPILER_IS_GNUCC AND (NOT WITH_CYCLES_KERNEL_ASAN))
|
|
|
|
# GCC hangs compiling the big kernel files with asan and release, so disable by default.
|
2020-11-06 10:29:04 +11:00
|
|
|
string(APPEND CMAKE_CXX_FLAGS_RELWITHDEBINFO " -fno-sanitize=all")
|
|
|
|
string(APPEND CMAKE_CXX_FLAGS_DEBUG " -fno-sanitize=vptr")
|
2019-08-13 06:02:48 +02:00
|
|
|
elseif(CMAKE_C_COMPILER_ID MATCHES "Clang")
|
2021-11-19 13:01:23 +01:00
|
|
|
# With OSL, Cycles disables rtti in some modules, which then breaks at linking
|
2019-08-13 06:02:48 +02:00
|
|
|
# when trying to use vptr sanitizer (included into 'undefined' general option).
|
2020-11-06 10:29:04 +11:00
|
|
|
string(APPEND CMAKE_CXX_FLAGS_RELWITHDEBINFO " -fno-sanitize=vptr")
|
|
|
|
string(APPEND CMAKE_CXX_FLAGS_DEBUG " -fno-sanitize=vptr")
|
2019-08-13 06:02:48 +02:00
|
|
|
endif()
|
2019-07-11 19:29:29 +02:00
|
|
|
endif()
|
|
|
|
|
Cycles: merge of cycles-x branch, a major update to the renderer
This includes much improved GPU rendering performance, viewport interactivity,
new shadow catcher, revamped sampling settings, subsurface scattering anisotropy,
new GPU volume sampling, improved PMJ sampling pattern, and more.
Some features have also been removed or changed, breaking backwards compatibility.
Including the removal of the OpenCL backend, for which alternatives are under
development.
Release notes and code docs:
https://wiki.blender.org/wiki/Reference/Release_Notes/3.0/Cycles
https://wiki.blender.org/wiki/Source/Render/Cycles
Credits:
* Sergey Sharybin
* Brecht Van Lommel
* Patrick Mours (OptiX backend)
* Christophe Hery (subsurface scattering anisotropy)
* William Leeson (PMJ sampling pattern)
* Alaska (various fixes and tweaks)
* Thomas Dinges (various fixes)
For the full commit history, see the cycles-x branch. This squashes together
all the changes since intermediate changes would often fail building or tests.
Ref T87839, T87837, T87836
Fixes T90734, T89353, T80267, T80267, T77185, T69800
2021-09-20 17:59:20 +02:00
|
|
|
set_source_files_properties(device/cpu/kernel.cpp PROPERTIES COMPILE_FLAGS "${CYCLES_KERNEL_FLAGS}")
|
2017-03-30 11:23:26 +02:00
|
|
|
|
2017-05-16 15:27:57 -04:00
|
|
|
if(CXX_HAS_SSE)
|
Cycles: merge of cycles-x branch, a major update to the renderer
This includes much improved GPU rendering performance, viewport interactivity,
new shadow catcher, revamped sampling settings, subsurface scattering anisotropy,
new GPU volume sampling, improved PMJ sampling pattern, and more.
Some features have also been removed or changed, breaking backwards compatibility.
Including the removal of the OpenCL backend, for which alternatives are under
development.
Release notes and code docs:
https://wiki.blender.org/wiki/Reference/Release_Notes/3.0/Cycles
https://wiki.blender.org/wiki/Source/Render/Cycles
Credits:
* Sergey Sharybin
* Brecht Van Lommel
* Patrick Mours (OptiX backend)
* Christophe Hery (subsurface scattering anisotropy)
* William Leeson (PMJ sampling pattern)
* Alaska (various fixes and tweaks)
* Thomas Dinges (various fixes)
For the full commit history, see the cycles-x branch. This squashes together
all the changes since intermediate changes would often fail building or tests.
Ref T87839, T87837, T87836
Fixes T90734, T89353, T80267, T80267, T77185, T69800
2021-09-20 17:59:20 +02:00
|
|
|
set_source_files_properties(device/cpu/kernel_sse2.cpp PROPERTIES COMPILE_FLAGS "${CYCLES_SSE2_KERNEL_FLAGS}")
|
|
|
|
set_source_files_properties(device/cpu/kernel_sse3.cpp PROPERTIES COMPILE_FLAGS "${CYCLES_SSE3_KERNEL_FLAGS}")
|
|
|
|
set_source_files_properties(device/cpu/kernel_sse41.cpp PROPERTIES COMPILE_FLAGS "${CYCLES_SSE41_KERNEL_FLAGS}")
|
2017-05-16 15:27:57 -04:00
|
|
|
endif()
|
2014-03-27 10:15:36 +11:00
|
|
|
|
2017-05-16 15:27:57 -04:00
|
|
|
if(CXX_HAS_AVX)
|
Cycles: merge of cycles-x branch, a major update to the renderer
This includes much improved GPU rendering performance, viewport interactivity,
new shadow catcher, revamped sampling settings, subsurface scattering anisotropy,
new GPU volume sampling, improved PMJ sampling pattern, and more.
Some features have also been removed or changed, breaking backwards compatibility.
Including the removal of the OpenCL backend, for which alternatives are under
development.
Release notes and code docs:
https://wiki.blender.org/wiki/Reference/Release_Notes/3.0/Cycles
https://wiki.blender.org/wiki/Source/Render/Cycles
Credits:
* Sergey Sharybin
* Brecht Van Lommel
* Patrick Mours (OptiX backend)
* Christophe Hery (subsurface scattering anisotropy)
* William Leeson (PMJ sampling pattern)
* Alaska (various fixes and tweaks)
* Thomas Dinges (various fixes)
For the full commit history, see the cycles-x branch. This squashes together
all the changes since intermediate changes would often fail building or tests.
Ref T87839, T87837, T87836
Fixes T90734, T89353, T80267, T80267, T77185, T69800
2021-09-20 17:59:20 +02:00
|
|
|
set_source_files_properties(device/cpu/kernel_avx.cpp PROPERTIES COMPILE_FLAGS "${CYCLES_AVX_KERNEL_FLAGS}")
|
2017-05-16 15:27:57 -04:00
|
|
|
endif()
|
2017-05-15 18:37:33 +02:00
|
|
|
|
2017-05-16 15:27:57 -04:00
|
|
|
if(CXX_HAS_AVX2)
|
Cycles: merge of cycles-x branch, a major update to the renderer
This includes much improved GPU rendering performance, viewport interactivity,
new shadow catcher, revamped sampling settings, subsurface scattering anisotropy,
new GPU volume sampling, improved PMJ sampling pattern, and more.
Some features have also been removed or changed, breaking backwards compatibility.
Including the removal of the OpenCL backend, for which alternatives are under
development.
Release notes and code docs:
https://wiki.blender.org/wiki/Reference/Release_Notes/3.0/Cycles
https://wiki.blender.org/wiki/Source/Render/Cycles
Credits:
* Sergey Sharybin
* Brecht Van Lommel
* Patrick Mours (OptiX backend)
* Christophe Hery (subsurface scattering anisotropy)
* William Leeson (PMJ sampling pattern)
* Alaska (various fixes and tweaks)
* Thomas Dinges (various fixes)
For the full commit history, see the cycles-x branch. This squashes together
all the changes since intermediate changes would often fail building or tests.
Ref T87839, T87837, T87836
Fixes T90734, T89353, T80267, T80267, T77185, T69800
2021-09-20 17:59:20 +02:00
|
|
|
set_source_files_properties(device/cpu/kernel_avx2.cpp PROPERTIES COMPILE_FLAGS "${CYCLES_AVX2_KERNEL_FLAGS}")
|
2014-12-07 15:22:05 +05:00
|
|
|
endif()
|
2013-11-22 14:16:47 +01:00
|
|
|
|
2019-04-16 06:11:27 +02:00
|
|
|
cycles_add_library(cycles_kernel "${LIB}"
|
2021-10-26 16:13:39 +02:00
|
|
|
${SRC_KERNEL_DEVICE_CPU}
|
|
|
|
${SRC_KERNEL_DEVICE_CUDA}
|
|
|
|
${SRC_KERNEL_DEVICE_HIP}
|
|
|
|
${SRC_KERNEL_DEVICE_OPTIX}
|
Cycles: Adapt shared kernel/device/gpu layer for MSL
This patch adapts the shared kernel entrypoints so that they can be compiled as MSL (Metal Shading Language). Where possible, the adaptations avoid changes in common code.
In MSL, kernel function inputs are explicitly bound to resources. In the case of argument buffers, we declare a struct containing the kernel arguments, accessible via device pointer. This differs from CUDA and HIP where kernel function arguments are declared as traditional C-style function parameters. This patch adapts the entrypoints declared in kernel.h so that they can be translated via a new `ccl_gpu_kernel_signature` macro into the required parameter struct + kernel entrypoint pairing for MSL.
MSL buffer attribution must be applied to function parameters or non-static class data members. To allow universal access to the integrator state, kernel data, and texture fetch adapters, we wrap all of the shared kernel code in a `MetalKernelContext` class. This is achieved by bracketing the appropriate kernel headers with "context_begin.h" and "context_end.h" on Metal. When calling deeper into the kernel code, we must reference the context class (e.g. `context.integrator_init_from_camera`). This extra prefixing is performed by a set of defines in "context_end.h". These will require explicit maintenance if entrypoints change. We invite discussion on more maintainable ways to enforce correctness.
Lambda expressions are not supported on MSL, so a new `ccl_gpu_kernel_lambda` macro generates an inline function object and optionally capturing any required state. This yields the same behaviour. This approach is applied to all parallel_... implementations which are templated by operation. The lambda expressions in the film_convert... kernels don't adapt cleanly to use function objects. However, these entrypoints can be macro-generated more concisely to avoid lambda expressions entirely, instead relying on constant folding to handle the pixel/channel conversions.
A separate implementation of `gpu_parallel_active_index_array` is provided for Metal to workaround some subtle differences in SIMD width, and also to encapsulate some required thread parameters which must be declared as explicit entrypoint function parameters.
Ref T92212
Reviewed By: brecht
Maniphest Tasks: T92212
Differential Revision: https://developer.blender.org/D13109
2021-11-09 21:30:46 +00:00
|
|
|
${SRC_KERNEL_DEVICE_METAL}
|
2021-10-26 16:13:39 +02:00
|
|
|
${SRC_KERNEL_HEADERS}
|
|
|
|
${SRC_KERNEL_DEVICE_CPU_HEADERS}
|
|
|
|
${SRC_KERNEL_DEVICE_GPU_HEADERS}
|
|
|
|
${SRC_KERNEL_DEVICE_CUDA_HEADERS}
|
|
|
|
${SRC_KERNEL_DEVICE_HIP_HEADERS}
|
|
|
|
${SRC_KERNEL_DEVICE_OPTIX_HEADERS}
|
Cycles: Adapt shared kernel/device/gpu layer for MSL
This patch adapts the shared kernel entrypoints so that they can be compiled as MSL (Metal Shading Language). Where possible, the adaptations avoid changes in common code.
In MSL, kernel function inputs are explicitly bound to resources. In the case of argument buffers, we declare a struct containing the kernel arguments, accessible via device pointer. This differs from CUDA and HIP where kernel function arguments are declared as traditional C-style function parameters. This patch adapts the entrypoints declared in kernel.h so that they can be translated via a new `ccl_gpu_kernel_signature` macro into the required parameter struct + kernel entrypoint pairing for MSL.
MSL buffer attribution must be applied to function parameters or non-static class data members. To allow universal access to the integrator state, kernel data, and texture fetch adapters, we wrap all of the shared kernel code in a `MetalKernelContext` class. This is achieved by bracketing the appropriate kernel headers with "context_begin.h" and "context_end.h" on Metal. When calling deeper into the kernel code, we must reference the context class (e.g. `context.integrator_init_from_camera`). This extra prefixing is performed by a set of defines in "context_end.h". These will require explicit maintenance if entrypoints change. We invite discussion on more maintainable ways to enforce correctness.
Lambda expressions are not supported on MSL, so a new `ccl_gpu_kernel_lambda` macro generates an inline function object and optionally capturing any required state. This yields the same behaviour. This approach is applied to all parallel_... implementations which are templated by operation. The lambda expressions in the film_convert... kernels don't adapt cleanly to use function objects. However, these entrypoints can be macro-generated more concisely to avoid lambda expressions entirely, instead relying on constant folding to handle the pixel/channel conversions.
A separate implementation of `gpu_parallel_active_index_array` is provided for Metal to workaround some subtle differences in SIMD width, and also to encapsulate some required thread parameters which must be declared as explicit entrypoint function parameters.
Ref T92212
Reviewed By: brecht
Maniphest Tasks: T92212
Differential Revision: https://developer.blender.org/D13109
2021-11-09 21:30:46 +00:00
|
|
|
${SRC_KERNEL_DEVICE_METAL_HEADERS}
|
2015-12-30 18:51:35 +05:00
|
|
|
)
|
2013-11-22 14:16:47 +01:00
|
|
|
|
2021-10-26 16:13:39 +02:00
|
|
|
source_group("bake" FILES ${SRC_KERNEL_BAKE_HEADERS})
|
|
|
|
source_group("bvh" FILES ${SRC_KERNEL_BVH_HEADERS})
|
|
|
|
source_group("camera" FILES ${SRC_KERNEL_CAMERA_HEADERS})
|
|
|
|
source_group("closure" FILES ${SRC_KERNEL_CLOSURE_HEADERS})
|
|
|
|
source_group("device\\cpu" FILES ${SRC_KERNEL_DEVICE_CPU} ${SRC_KERNEL_DEVICE_CPU_HEADERS})
|
|
|
|
source_group("device\\cuda" FILES ${SRC_KERNEL_DEVICE_CUDA} ${SRC_KERNEL_DEVICE_CUDA_HEADERS})
|
|
|
|
source_group("device\\gpu" FILES ${SRC_KERNEL_DEVICE_GPU_HEADERS})
|
|
|
|
source_group("device\\hip" FILES ${SRC_KERNEL_DEVICE_HIP} ${SRC_KERNEL_DEVICE_HIP_HEADERS})
|
|
|
|
source_group("device\\optix" FILES ${SRC_KERNEL_DEVICE_OPTIX} ${SRC_KERNEL_DEVICE_OPTIX_HEADERS})
|
Cycles: Adapt shared kernel/device/gpu layer for MSL
This patch adapts the shared kernel entrypoints so that they can be compiled as MSL (Metal Shading Language). Where possible, the adaptations avoid changes in common code.
In MSL, kernel function inputs are explicitly bound to resources. In the case of argument buffers, we declare a struct containing the kernel arguments, accessible via device pointer. This differs from CUDA and HIP where kernel function arguments are declared as traditional C-style function parameters. This patch adapts the entrypoints declared in kernel.h so that they can be translated via a new `ccl_gpu_kernel_signature` macro into the required parameter struct + kernel entrypoint pairing for MSL.
MSL buffer attribution must be applied to function parameters or non-static class data members. To allow universal access to the integrator state, kernel data, and texture fetch adapters, we wrap all of the shared kernel code in a `MetalKernelContext` class. This is achieved by bracketing the appropriate kernel headers with "context_begin.h" and "context_end.h" on Metal. When calling deeper into the kernel code, we must reference the context class (e.g. `context.integrator_init_from_camera`). This extra prefixing is performed by a set of defines in "context_end.h". These will require explicit maintenance if entrypoints change. We invite discussion on more maintainable ways to enforce correctness.
Lambda expressions are not supported on MSL, so a new `ccl_gpu_kernel_lambda` macro generates an inline function object and optionally capturing any required state. This yields the same behaviour. This approach is applied to all parallel_... implementations which are templated by operation. The lambda expressions in the film_convert... kernels don't adapt cleanly to use function objects. However, these entrypoints can be macro-generated more concisely to avoid lambda expressions entirely, instead relying on constant folding to handle the pixel/channel conversions.
A separate implementation of `gpu_parallel_active_index_array` is provided for Metal to workaround some subtle differences in SIMD width, and also to encapsulate some required thread parameters which must be declared as explicit entrypoint function parameters.
Ref T92212
Reviewed By: brecht
Maniphest Tasks: T92212
Differential Revision: https://developer.blender.org/D13109
2021-11-09 21:30:46 +00:00
|
|
|
source_group("device\\metal" FILES ${SRC_KERNEL_DEVICE_METAL} ${SRC_KERNEL_DEVICE_METAL_HEADERS})
|
2021-10-26 16:13:39 +02:00
|
|
|
source_group("film" FILES ${SRC_KERNEL_FILM_HEADERS})
|
|
|
|
source_group("geom" FILES ${SRC_KERNEL_GEOM_HEADERS})
|
|
|
|
source_group("integrator" FILES ${SRC_KERNEL_INTEGRATOR_HEADERS})
|
|
|
|
source_group("kernel" FILES ${SRC_KERNEL_TYPES_HEADERS})
|
|
|
|
source_group("light" FILES ${SRC_KERNEL_LIGHT_HEADERS})
|
|
|
|
source_group("sample" FILES ${SRC_KERNEL_SAMPLE_HEADERS})
|
|
|
|
source_group("svm" FILES ${SRC_KERNEL_SVM_HEADERS})
|
|
|
|
source_group("util" FILES ${SRC_KERNEL_UTIL_HEADERS})
|
2019-09-12 14:50:06 +02:00
|
|
|
|
2011-08-16 16:15:34 +00:00
|
|
|
if(WITH_CYCLES_CUDA)
|
|
|
|
add_dependencies(cycles_kernel cycles_kernel_cuda)
|
|
|
|
endif()
|
2020-04-11 12:59:21 -06:00
|
|
|
if(WITH_CYCLES_DEVICE_OPTIX AND WITH_CYCLES_CUDA_BINARIES)
|
2019-09-12 14:50:06 +02:00
|
|
|
add_dependencies(cycles_kernel cycles_kernel_optix)
|
|
|
|
endif()
|
2021-09-28 16:51:14 +02:00
|
|
|
if(WITH_CYCLES_HIP)
|
|
|
|
add_dependencies(cycles_kernel cycles_kernel_hip)
|
|
|
|
endif()
|
2011-04-27 11:58:34 +00:00
|
|
|
|
Cycles: merge of cycles-x branch, a major update to the renderer
This includes much improved GPU rendering performance, viewport interactivity,
new shadow catcher, revamped sampling settings, subsurface scattering anisotropy,
new GPU volume sampling, improved PMJ sampling pattern, and more.
Some features have also been removed or changed, breaking backwards compatibility.
Including the removal of the OpenCL backend, for which alternatives are under
development.
Release notes and code docs:
https://wiki.blender.org/wiki/Reference/Release_Notes/3.0/Cycles
https://wiki.blender.org/wiki/Source/Render/Cycles
Credits:
* Sergey Sharybin
* Brecht Van Lommel
* Patrick Mours (OptiX backend)
* Christophe Hery (subsurface scattering anisotropy)
* William Leeson (PMJ sampling pattern)
* Alaska (various fixes and tweaks)
* Thomas Dinges (various fixes)
For the full commit history, see the cycles-x branch. This squashes together
all the changes since intermediate changes would often fail building or tests.
Ref T87839, T87837, T87836
Fixes T90734, T89353, T80267, T80267, T77185, T69800
2021-09-20 17:59:20 +02:00
|
|
|
# Install kernel source for runtime compilation
|
2011-09-02 14:55:06 +00:00
|
|
|
|
2021-10-26 16:13:39 +02:00
|
|
|
delayed_install(${CMAKE_CURRENT_SOURCE_DIR} "${SRC_KERNEL_BAKE_HEADERS}" ${CYCLES_INSTALL_PATH}/source/kernel/bake)
|
|
|
|
delayed_install(${CMAKE_CURRENT_SOURCE_DIR} "${SRC_KERNEL_BVH_HEADERS}" ${CYCLES_INSTALL_PATH}/source/kernel/bvh)
|
|
|
|
delayed_install(${CMAKE_CURRENT_SOURCE_DIR} "${SRC_KERNEL_CAMERA_HEADERS}" ${CYCLES_INSTALL_PATH}/source/kernel/camera)
|
|
|
|
delayed_install(${CMAKE_CURRENT_SOURCE_DIR} "${SRC_KERNEL_CLOSURE_HEADERS}" ${CYCLES_INSTALL_PATH}/source/kernel/closure)
|
|
|
|
delayed_install(${CMAKE_CURRENT_SOURCE_DIR} "${SRC_KERNEL_DEVICE_CUDA}" ${CYCLES_INSTALL_PATH}/source/kernel/device/cuda)
|
|
|
|
delayed_install(${CMAKE_CURRENT_SOURCE_DIR} "${SRC_KERNEL_DEVICE_CUDA_HEADERS}" ${CYCLES_INSTALL_PATH}/source/kernel/device/cuda)
|
|
|
|
delayed_install(${CMAKE_CURRENT_SOURCE_DIR} "${SRC_KERNEL_DEVICE_GPU_HEADERS}" ${CYCLES_INSTALL_PATH}/source/kernel/device/gpu)
|
|
|
|
delayed_install(${CMAKE_CURRENT_SOURCE_DIR} "${SRC_KERNEL_DEVICE_HIP}" ${CYCLES_INSTALL_PATH}/source/kernel/device/hip)
|
|
|
|
delayed_install(${CMAKE_CURRENT_SOURCE_DIR} "${SRC_KERNEL_DEVICE_HIP_HEADERS}" ${CYCLES_INSTALL_PATH}/source/kernel/device/hip)
|
|
|
|
delayed_install(${CMAKE_CURRENT_SOURCE_DIR} "${SRC_KERNEL_DEVICE_OPTIX}" ${CYCLES_INSTALL_PATH}/source/kernel/device/optix)
|
|
|
|
delayed_install(${CMAKE_CURRENT_SOURCE_DIR} "${SRC_KERNEL_DEVICE_OPTIX_HEADERS}" ${CYCLES_INSTALL_PATH}/source/kernel/device/optix)
|
Cycles: Adapt shared kernel/device/gpu layer for MSL
This patch adapts the shared kernel entrypoints so that they can be compiled as MSL (Metal Shading Language). Where possible, the adaptations avoid changes in common code.
In MSL, kernel function inputs are explicitly bound to resources. In the case of argument buffers, we declare a struct containing the kernel arguments, accessible via device pointer. This differs from CUDA and HIP where kernel function arguments are declared as traditional C-style function parameters. This patch adapts the entrypoints declared in kernel.h so that they can be translated via a new `ccl_gpu_kernel_signature` macro into the required parameter struct + kernel entrypoint pairing for MSL.
MSL buffer attribution must be applied to function parameters or non-static class data members. To allow universal access to the integrator state, kernel data, and texture fetch adapters, we wrap all of the shared kernel code in a `MetalKernelContext` class. This is achieved by bracketing the appropriate kernel headers with "context_begin.h" and "context_end.h" on Metal. When calling deeper into the kernel code, we must reference the context class (e.g. `context.integrator_init_from_camera`). This extra prefixing is performed by a set of defines in "context_end.h". These will require explicit maintenance if entrypoints change. We invite discussion on more maintainable ways to enforce correctness.
Lambda expressions are not supported on MSL, so a new `ccl_gpu_kernel_lambda` macro generates an inline function object and optionally capturing any required state. This yields the same behaviour. This approach is applied to all parallel_... implementations which are templated by operation. The lambda expressions in the film_convert... kernels don't adapt cleanly to use function objects. However, these entrypoints can be macro-generated more concisely to avoid lambda expressions entirely, instead relying on constant folding to handle the pixel/channel conversions.
A separate implementation of `gpu_parallel_active_index_array` is provided for Metal to workaround some subtle differences in SIMD width, and also to encapsulate some required thread parameters which must be declared as explicit entrypoint function parameters.
Ref T92212
Reviewed By: brecht
Maniphest Tasks: T92212
Differential Revision: https://developer.blender.org/D13109
2021-11-09 21:30:46 +00:00
|
|
|
delayed_install(${CMAKE_CURRENT_SOURCE_DIR} "${SRC_KERNEL_DEVICE_METAL}" ${CYCLES_INSTALL_PATH}/source/kernel/device/metal)
|
|
|
|
delayed_install(${CMAKE_CURRENT_SOURCE_DIR} "${SRC_KERNEL_DEVICE_METAL_HEADERS}" ${CYCLES_INSTALL_PATH}/source/kernel/device/metal)
|
2021-10-26 16:13:39 +02:00
|
|
|
delayed_install(${CMAKE_CURRENT_SOURCE_DIR} "${SRC_KERNEL_FILM_HEADERS}" ${CYCLES_INSTALL_PATH}/source/kernel/film)
|
|
|
|
delayed_install(${CMAKE_CURRENT_SOURCE_DIR} "${SRC_KERNEL_GEOM_HEADERS}" ${CYCLES_INSTALL_PATH}/source/kernel/geom)
|
|
|
|
delayed_install(${CMAKE_CURRENT_SOURCE_DIR} "${SRC_KERNEL_INTEGRATOR_HEADERS}" ${CYCLES_INSTALL_PATH}/source/kernel/integrator)
|
|
|
|
delayed_install(${CMAKE_CURRENT_SOURCE_DIR} "${SRC_KERNEL_LIGHT_HEADERS}" ${CYCLES_INSTALL_PATH}/source/kernel/light)
|
|
|
|
delayed_install(${CMAKE_CURRENT_SOURCE_DIR} "${SRC_KERNEL_SAMPLE_HEADERS}" ${CYCLES_INSTALL_PATH}/source/kernel/sample)
|
|
|
|
delayed_install(${CMAKE_CURRENT_SOURCE_DIR} "${SRC_KERNEL_SVM_HEADERS}" ${CYCLES_INSTALL_PATH}/source/kernel/svm)
|
|
|
|
delayed_install(${CMAKE_CURRENT_SOURCE_DIR} "${SRC_KERNEL_TYPES_HEADERS}" ${CYCLES_INSTALL_PATH}/source/kernel)
|
|
|
|
delayed_install(${CMAKE_CURRENT_SOURCE_DIR} "${SRC_KERNEL_UTIL_HEADERS}" ${CYCLES_INSTALL_PATH}/source/kernel/util)
|
Cycles: Make all #include statements relative to cycles source directory
The idea is to make include statements more explicit and obvious where the
file is coming from, additionally reducing chance of wrong header being
picked up.
For example, it was not obvious whether bvh.h was refferring to builder
or traversal, whenter node.h is a generic graph node or a shader node
and cases like that.
Surely this might look obvious for the active developers, but after some
time of not touching the code it becomes less obvious where file is coming
from.
This was briefly mentioned in T50824 and seems @brecht is fine with such
explicitness, but need to agree with all active developers before committing
this.
Please note that this patch is lacking changes related on GPU/OpenCL
support. This will be solved if/when we all agree this is a good idea to move
forward.
Reviewers: brecht, lukasstockner97, maiself, nirved, dingto, juicyfruit, swerner
Reviewed By: lukasstockner97, maiself, nirved, dingto
Subscribers: brecht
Differential Revision: https://developer.blender.org/D2586
2017-03-28 20:39:14 +02:00
|
|
|
delayed_install(${CMAKE_CURRENT_SOURCE_DIR} "${SRC_UTIL_HEADERS}" ${CYCLES_INSTALL_PATH}/source/util)
|
2020-10-02 17:40:28 +02:00
|
|
|
|
|
|
|
if(WITH_NANOVDB)
|
|
|
|
set(SRC_NANOVDB_HEADERS
|
|
|
|
nanovdb/NanoVDB.h
|
|
|
|
nanovdb/CNanoVDB.h
|
|
|
|
)
|
|
|
|
set(SRC_NANOVDB_UTIL_HEADERS
|
|
|
|
nanovdb/util/CSampleFromVoxels.h
|
|
|
|
nanovdb/util/SampleFromVoxels.h
|
|
|
|
)
|
|
|
|
delayed_install(${NANOVDB_INCLUDE_DIR} "${SRC_NANOVDB_HEADERS}" ${CYCLES_INSTALL_PATH}/source/nanovdb)
|
|
|
|
delayed_install(${NANOVDB_INCLUDE_DIR} "${SRC_NANOVDB_UTIL_HEADERS}" ${CYCLES_INSTALL_PATH}/source/nanovdb/util)
|
|
|
|
endif()
|