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.
This commit is contained in:
Brecht Van Lommel 2021-10-24 14:19:19 +02:00
parent b698fe1e04
commit d7d40745fa
322 changed files with 1013 additions and 874 deletions

View file

@ -400,7 +400,8 @@ add_subdirectory(doc)
add_subdirectory(graph)
add_subdirectory(integrator)
add_subdirectory(kernel)
add_subdirectory(render)
add_subdirectory(scene)
add_subdirectory(session)
add_subdirectory(subd)
add_subdirectory(util)

View file

@ -25,7 +25,8 @@ set(INC_SYS
set(LIBRARIES
cycles_device
cycles_kernel
cycles_render
cycles_scene
cycles_session
cycles_bvh
cycles_subd
cycles_graph

View file

@ -17,11 +17,11 @@
#include <stdio.h>
#include "device/device.h"
#include "render/buffers.h"
#include "render/camera.h"
#include "render/integrator.h"
#include "render/scene.h"
#include "render/session.h"
#include "scene/camera.h"
#include "scene/integrator.h"
#include "scene/scene.h"
#include "session/buffers.h"
#include "session/session.h"
#include "util/util_args.h"
#include "util/util_foreach.h"

View file

@ -22,18 +22,18 @@
#include "graph/node_xml.h"
#include "render/background.h"
#include "render/camera.h"
#include "render/film.h"
#include "render/graph.h"
#include "render/integrator.h"
#include "render/light.h"
#include "render/mesh.h"
#include "render/nodes.h"
#include "render/object.h"
#include "render/osl.h"
#include "render/scene.h"
#include "render/shader.h"
#include "scene/background.h"
#include "scene/camera.h"
#include "scene/film.h"
#include "scene/integrator.h"
#include "scene/light.h"
#include "scene/mesh.h"
#include "scene/object.h"
#include "scene/osl.h"
#include "scene/scene.h"
#include "scene/shader.h"
#include "scene/shader_graph.h"
#include "scene/shader_nodes.h"
#include "subd/subd_patch.h"
#include "subd/subd_split.h"

View file

@ -14,7 +14,7 @@
* limitations under the License.
*/
#include "render/output_driver.h"
#include "session/output_driver.h"
#include "util/util_function.h"
#include "util/util_image.h"

View file

@ -69,7 +69,8 @@ set(LIB
cycles_device
cycles_graph
cycles_kernel
cycles_render
cycles_scene
cycles_session
cycles_subd
cycles_util

View file

@ -14,8 +14,8 @@
* limitations under the License.
*/
#include "render/camera.h"
#include "render/scene.h"
#include "scene/camera.h"
#include "scene/scene.h"
#include "blender/blender_sync.h"
#include "blender/blender_util.h"

View file

@ -14,16 +14,17 @@
* limitations under the License.
*/
#include "render/attribute.h"
#include "render/camera.h"
#include "render/curves.h"
#include "render/hair.h"
#include "render/object.h"
#include "render/scene.h"
#include "scene/attribute.h"
#include "scene/camera.h"
#include "scene/curves.h"
#include "scene/hair.h"
#include "scene/object.h"
#include "scene/scene.h"
#include "blender/blender_sync.h"
#include "blender/blender_util.h"
#include "util/util_color.h"
#include "util/util_foreach.h"
#include "util/util_hash.h"
#include "util/util_logging.h"

View file

@ -22,7 +22,7 @@
#include "RNA_blender_cpp.h"
#include "render/display_driver.h"
#include "session/display_driver.h"
#include "util/util_thread.h"
#include "util/util_unique_ptr.h"

View file

@ -15,11 +15,11 @@
* limitations under the License.
*/
#include "render/curves.h"
#include "render/hair.h"
#include "render/mesh.h"
#include "render/object.h"
#include "render/volume.h"
#include "scene/curves.h"
#include "scene/hair.h"
#include "scene/mesh.h"
#include "scene/object.h"
#include "scene/volume.h"
#include "blender/blender_sync.h"
#include "blender/blender_util.h"

View file

@ -19,8 +19,8 @@
#include <string.h>
#include "render/geometry.h"
#include "render/scene.h"
#include "scene/geometry.h"
#include "scene/scene.h"
#include "util/util_map.h"
#include "util/util_set.h"

View file

@ -19,7 +19,7 @@
#include "RNA_blender_cpp.h"
#include "render/image.h"
#include "scene/image.h"
CCL_NAMESPACE_BEGIN

View file

@ -16,7 +16,7 @@
* limitations under the License.
*/
#include "render/light.h"
#include "scene/light.h"
#include "blender/blender_sync.h"
#include "blender/blender_util.h"

View file

@ -14,11 +14,11 @@
* limitations under the License.
*/
#include "render/camera.h"
#include "render/colorspace.h"
#include "render/mesh.h"
#include "render/object.h"
#include "render/scene.h"
#include "scene/camera.h"
#include "scene/colorspace.h"
#include "scene/mesh.h"
#include "scene/object.h"
#include "scene/scene.h"
#include "blender/blender_session.h"
#include "blender/blender_sync.h"
@ -28,6 +28,7 @@
#include "subd/subd_split.h"
#include "util/util_algorithm.h"
#include "util/util_color.h"
#include "util/util_disjoint_set.h"
#include "util/util_foreach.h"
#include "util/util_hash.h"

View file

@ -14,17 +14,17 @@
* limitations under the License.
*/
#include "render/alembic.h"
#include "render/camera.h"
#include "render/graph.h"
#include "render/integrator.h"
#include "render/light.h"
#include "render/mesh.h"
#include "render/nodes.h"
#include "render/object.h"
#include "render/particles.h"
#include "render/scene.h"
#include "render/shader.h"
#include "scene/alembic.h"
#include "scene/camera.h"
#include "scene/integrator.h"
#include "scene/light.h"
#include "scene/mesh.h"
#include "scene/object.h"
#include "scene/particles.h"
#include "scene/scene.h"
#include "scene/shader.h"
#include "scene/shader_graph.h"
#include "scene/shader_nodes.h"
#include "blender/blender_object_cull.h"
#include "blender/blender_sync.h"

View file

@ -16,7 +16,7 @@
#include <cstdlib>
#include "render/camera.h"
#include "scene/camera.h"
#include "blender/blender_object_cull.h"
#include "blender/blender_util.h"

View file

@ -20,7 +20,7 @@
#include "RNA_blender_cpp.h"
#include "render/output_driver.h"
#include "session/output_driver.h"
CCL_NAMESPACE_BEGIN

View file

@ -14,9 +14,9 @@
* limitations under the License.
*/
#include "render/mesh.h"
#include "render/object.h"
#include "render/particles.h"
#include "scene/mesh.h"
#include "scene/object.h"
#include "scene/particles.h"
#include "blender/blender_sync.h"
#include "blender/blender_util.h"

View file

@ -23,8 +23,8 @@
#include "blender/blender_sync.h"
#include "blender/blender_util.h"
#include "render/denoising.h"
#include "render/merge.h"
#include "session/denoising.h"
#include "session/merge.h"
#include "util/util_debug.h"
#include "util/util_foreach.h"
@ -39,7 +39,7 @@
#include "util/util_types.h"
#ifdef WITH_OSL
# include "render/osl.h"
# include "scene/osl.h"
# include <OSL/oslconfig.h>
# include <OSL/oslquery.h>

View file

@ -17,19 +17,19 @@
#include <stdlib.h>
#include "device/device.h"
#include "render/background.h"
#include "render/buffers.h"
#include "render/camera.h"
#include "render/colorspace.h"
#include "render/film.h"
#include "render/integrator.h"
#include "render/light.h"
#include "render/mesh.h"
#include "render/object.h"
#include "render/scene.h"
#include "render/session.h"
#include "render/shader.h"
#include "render/stats.h"
#include "scene/background.h"
#include "scene/camera.h"
#include "scene/colorspace.h"
#include "scene/film.h"
#include "scene/integrator.h"
#include "scene/light.h"
#include "scene/mesh.h"
#include "scene/object.h"
#include "scene/scene.h"
#include "scene/shader.h"
#include "scene/stats.h"
#include "session/buffers.h"
#include "session/session.h"
#include "util/util_algorithm.h"
#include "util/util_color.h"

View file

@ -21,9 +21,9 @@
#include "device/device.h"
#include "render/bake.h"
#include "render/scene.h"
#include "render/session.h"
#include "scene/bake.h"
#include "scene/scene.h"
#include "session/session.h"
#include "util/util_vector.h"

View file

@ -14,15 +14,15 @@
* limitations under the License.
*/
#include "render/background.h"
#include "render/colorspace.h"
#include "render/graph.h"
#include "render/integrator.h"
#include "render/light.h"
#include "render/nodes.h"
#include "render/osl.h"
#include "render/scene.h"
#include "render/shader.h"
#include "scene/background.h"
#include "scene/colorspace.h"
#include "scene/integrator.h"
#include "scene/light.h"
#include "scene/osl.h"
#include "scene/scene.h"
#include "scene/shader.h"
#include "scene/shader_graph.h"
#include "scene/shader_nodes.h"
#include "blender/blender_image.h"
#include "blender/blender_sync.h"

View file

@ -14,19 +14,19 @@
* limitations under the License.
*/
#include "render/background.h"
#include "render/camera.h"
#include "render/curves.h"
#include "render/film.h"
#include "render/graph.h"
#include "render/integrator.h"
#include "render/light.h"
#include "render/mesh.h"
#include "render/nodes.h"
#include "render/object.h"
#include "render/procedural.h"
#include "render/scene.h"
#include "render/shader.h"
#include "scene/background.h"
#include "scene/camera.h"
#include "scene/curves.h"
#include "scene/film.h"
#include "scene/integrator.h"
#include "scene/light.h"
#include "scene/mesh.h"
#include "scene/object.h"
#include "scene/procedural.h"
#include "scene/scene.h"
#include "scene/shader.h"
#include "scene/shader_graph.h"
#include "scene/shader_nodes.h"
#include "device/device.h"

View file

@ -26,8 +26,8 @@
#include "blender/blender_util.h"
#include "blender/blender_viewport.h"
#include "render/scene.h"
#include "render/session.h"
#include "scene/scene.h"
#include "session/session.h"
#include "util/util_map.h"
#include "util/util_set.h"

View file

@ -17,7 +17,7 @@
#ifndef __BLENDER_UTIL_H__
#define __BLENDER_UTIL_H__
#include "render/mesh.h"
#include "scene/mesh.h"
#include "util/util_algorithm.h"
#include "util/util_array.h"

View file

@ -17,7 +17,7 @@
#include "blender_viewport.h"
#include "blender_util.h"
#include "render/pass.h"
#include "scene/pass.h"
#include "util/util_logging.h"
CCL_NAMESPACE_BEGIN

View file

@ -23,7 +23,7 @@
#include "RNA_blender_cpp.h"
#include "RNA_types.h"
#include "render/film.h"
#include "scene/film.h"
CCL_NAMESPACE_BEGIN

View file

@ -14,11 +14,11 @@
* limitations under the License.
*/
#include "render/colorspace.h"
#include "render/image.h"
#include "render/image_vdb.h"
#include "render/object.h"
#include "render/volume.h"
#include "scene/colorspace.h"
#include "scene/image.h"
#include "scene/image_vdb.h"
#include "scene/object.h"
#include "scene/volume.h"
#include "blender/blender_sync.h"
#include "blender/blender_util.h"

View file

@ -49,7 +49,7 @@ set(SRC_HEADERS
)
set(LIB
cycles_render
cycles_scene
cycles_util
)

View file

@ -17,9 +17,9 @@
#include "bvh/bvh2.h"
#include "render/hair.h"
#include "render/mesh.h"
#include "render/object.h"
#include "scene/hair.h"
#include "scene/mesh.h"
#include "scene/object.h"
#include "bvh/bvh_build.h"
#include "bvh/bvh_node.h"

View file

@ -22,11 +22,11 @@
#include "bvh/bvh_params.h"
#include "bvh_split.h"
#include "render/curves.h"
#include "render/hair.h"
#include "render/mesh.h"
#include "render/object.h"
#include "render/scene.h"
#include "scene/curves.h"
#include "scene/hair.h"
#include "scene/mesh.h"
#include "scene/object.h"
#include "scene/scene.h"
#include "util/util_algorithm.h"
#include "util/util_foreach.h"

View file

@ -40,11 +40,11 @@
# include "kernel/bvh/bvh_util.h"
# include "kernel/device/cpu/compat.h"
# include "kernel/device/cpu/globals.h"
# include "kernel/kernel_random.h"
# include "kernel/sample/sample_lcg.h"
# include "render/hair.h"
# include "render/mesh.h"
# include "render/object.h"
# include "scene/hair.h"
# include "scene/mesh.h"
# include "scene/object.h"
# include "util/util_foreach.h"
# include "util/util_logging.h"

View file

@ -20,9 +20,9 @@
#include "bvh/bvh_build.h"
#include "bvh/bvh_sort.h"
#include "render/hair.h"
#include "render/mesh.h"
#include "render/object.h"
#include "scene/hair.h"
#include "scene/mesh.h"
#include "scene/object.h"
#include "util/util_algorithm.h"

View file

@ -16,8 +16,8 @@
#include "bvh/bvh_unaligned.h"
#include "render/hair.h"
#include "render/object.h"
#include "scene/hair.h"
#include "scene/object.h"
#include "bvh/bvh_binning.h"
#include "bvh_params.h"

View file

@ -47,7 +47,7 @@
#include "bvh/bvh_embree.h"
#include "render/buffers.h"
#include "session/buffers.h"
#include "util/util_debug.h"
#include "util/util_foreach.h"

View file

@ -24,8 +24,6 @@
# include "device/cuda/device_impl.h"
# include "render/buffers.h"
# include "util/util_debug.h"
# include "util/util_foreach.h"
# include "util/util_logging.h"

View file

@ -18,7 +18,7 @@
#include "device/device_memory.h"
#include "graph/node.h"
#include "render/buffers.h"
#include "session/buffers.h"
CCL_NAMESPACE_BEGIN

View file

@ -16,7 +16,7 @@
#pragma once
#include "render/display_driver.h"
#include "session/display_driver.h"
#include "util/util_types.h"

View file

@ -24,8 +24,6 @@
# include "device/hip/device_impl.h"
# include "render/buffers.h"
# include "util/util_debug.h"
# include "util/util_foreach.h"
# include "util/util_logging.h"

View file

@ -24,8 +24,7 @@
#include "device/device.h"
#include "device/device_queue.h"
#include "render/buffers.h"
#include "render/geometry.h"
#include "scene/geometry.h"
#include "util/util_foreach.h"
#include "util/util_list.h"

View file

@ -21,13 +21,14 @@
# include "bvh/bvh.h"
# include "bvh/bvh_optix.h"
# include "integrator/pass_accessor_gpu.h"
# include "render/buffers.h"
# include "render/hair.h"
# include "render/mesh.h"
# include "render/object.h"
# include "render/pass.h"
# include "render/scene.h"
# include "scene/hair.h"
# include "scene/mesh.h"
# include "scene/object.h"
# include "scene/pass.h"
# include "scene/scene.h"
# include "util/util_debug.h"
# include "util/util_logging.h"

View file

@ -61,9 +61,11 @@ set(SRC_HEADERS
)
set(LIB
cycles_device
# NOTE: Is required for RenderBuffers access. Might consider moving files around a bit to
# avoid such cyclic dependency.
cycles_render
cycles_session
cycles_util
)

View file

@ -19,7 +19,7 @@
#include "device/device.h"
#include "integrator/denoiser_oidn.h"
#include "integrator/denoiser_optix.h"
#include "render/buffers.h"
#include "session/buffers.h"
#include "util/util_logging.h"
#include "util/util_progress.h"

View file

@ -20,7 +20,7 @@
#include "device/device_denoise.h"
#include "device/device_memory.h"
#include "device/device_queue.h"
#include "render/buffers.h"
#include "session/buffers.h"
#include "util/util_logging.h"
#include "util/util_progress.h"

View file

@ -21,7 +21,7 @@
#include "device/device.h"
#include "device/device_queue.h"
#include "integrator/pass_accessor_cpu.h"
#include "render/buffers.h"
#include "session/buffers.h"
#include "util/util_array.h"
#include "util/util_logging.h"
#include "util/util_openimagedenoise.h"

View file

@ -16,7 +16,7 @@
#include "integrator/pass_accessor.h"
#include "render/buffers.h"
#include "session/buffers.h"
#include "util/util_logging.h"
// clang-format off

View file

@ -16,7 +16,7 @@
#pragma once
#include "render/pass.h"
#include "scene/pass.h"
#include "util/util_half.h"
#include "util/util_string.h"
#include "util/util_types.h"

View file

@ -16,7 +16,7 @@
#include "integrator/pass_accessor_cpu.h"
#include "render/buffers.h"
#include "session/buffers.h"
#include "util/util_logging.h"
#include "util/util_tbb.h"
@ -24,7 +24,7 @@
#include "kernel/device/cpu/compat.h"
#include "kernel/device/cpu/globals.h"
#include "kernel/kernel_types.h"
#include "kernel/kernel_film.h"
#include "kernel/film/film_read.h"
// clang-format on
CCL_NAMESPACE_BEGIN

View file

@ -17,7 +17,7 @@
#include "integrator/pass_accessor_gpu.h"
#include "device/device_queue.h"
#include "render/buffers.h"
#include "session/buffers.h"
#include "util/util_logging.h"
CCL_NAMESPACE_BEGIN

View file

@ -22,9 +22,9 @@
#include "integrator/path_trace_display.h"
#include "integrator/path_trace_tile.h"
#include "integrator/render_scheduler.h"
#include "render/pass.h"
#include "render/scene.h"
#include "render/tile.h"
#include "scene/pass.h"
#include "scene/scene.h"
#include "session/tile.h"
#include "util/util_algorithm.h"
#include "util/util_logging.h"
#include "util/util_progress.h"

View file

@ -20,7 +20,7 @@
#include "integrator/pass_accessor.h"
#include "integrator/path_trace_work.h"
#include "integrator/work_balancer.h"
#include "render/buffers.h"
#include "session/buffers.h"
#include "util/util_function.h"
#include "util/util_thread.h"
#include "util/util_unique_ptr.h"

View file

@ -16,7 +16,7 @@
#include "integrator/path_trace_display.h"
#include "render/buffers.h"
#include "session/buffers.h"
#include "util/util_logging.h"

View file

@ -16,7 +16,7 @@
#pragma once
#include "render/display_driver.h"
#include "session/display_driver.h"
#include "util/util_half.h"
#include "util/util_thread.h"

View file

@ -18,10 +18,10 @@
#include "integrator/pass_accessor_cpu.h"
#include "integrator/path_trace.h"
#include "render/buffers.h"
#include "render/film.h"
#include "render/pass.h"
#include "render/scene.h"
#include "scene/film.h"
#include "scene/pass.h"
#include "scene/scene.h"
#include "session/buffers.h"
CCL_NAMESPACE_BEGIN

View file

@ -16,7 +16,7 @@
#pragma once
#include "render/output_driver.h"
#include "session/output_driver.h"
CCL_NAMESPACE_BEGIN

View file

@ -20,9 +20,9 @@
#include "integrator/path_trace_work.h"
#include "integrator/path_trace_work_cpu.h"
#include "integrator/path_trace_work_gpu.h"
#include "render/buffers.h"
#include "render/film.h"
#include "render/scene.h"
#include "scene/film.h"
#include "scene/scene.h"
#include "session/buffers.h"
#include "kernel/kernel_types.h"

View file

@ -17,8 +17,8 @@
#pragma once
#include "integrator/pass_accessor.h"
#include "render/buffers.h"
#include "render/pass.h"
#include "scene/pass.h"
#include "session/buffers.h"
#include "util/util_types.h"
#include "util/util_unique_ptr.h"

View file

@ -19,13 +19,13 @@
#include "device/cpu/kernel.h"
#include "device/device.h"
#include "kernel/kernel_path_state.h"
#include "kernel/integrator/integrator_path_state.h"
#include "integrator/pass_accessor_cpu.h"
#include "integrator/path_trace_display.h"
#include "render/buffers.h"
#include "render/scene.h"
#include "scene/scene.h"
#include "session/buffers.h"
#include "util/util_atomic.h"
#include "util/util_logging.h"

View file

@ -20,8 +20,8 @@
#include "device/device.h"
#include "integrator/pass_accessor_gpu.h"
#include "render/buffers.h"
#include "render/scene.h"
#include "scene/scene.h"
#include "session/buffers.h"
#include "util/util_logging.h"
#include "util/util_string.h"
#include "util/util_tbb.h"

View file

@ -16,8 +16,8 @@
#include "integrator/render_scheduler.h"
#include "render/session.h"
#include "render/tile.h"
#include "session/session.h"
#include "session/tile.h"
#include "util/util_logging.h"
#include "util/util_math.h"
#include "util/util_time.h"

View file

@ -18,7 +18,7 @@
#include "integrator/adaptive_sampling.h"
#include "integrator/denoiser.h" /* For DenoiseParams. */
#include "render/buffers.h"
#include "session/buffers.h"
#include "util/util_string.h"
CCL_NAMESPACE_BEGIN

View file

@ -18,7 +18,7 @@
#include "device/device_queue.h"
#include "integrator/tile.h"
#include "render/buffers.h"
#include "session/buffers.h"
#include "util/util_atomic.h"
#include "util/util_logging.h"

View file

@ -44,7 +44,8 @@ set(SRC_DEVICE_OPTIX
device/optix/kernel_shader_raytrace.cu
)
set(SRC_BVH_HEADERS
set(SRC_HEADERS
bake/bake.h
bvh/bvh.h
bvh/bvh_nodes.h
bvh/bvh_shadow_all.h
@ -55,36 +56,32 @@ set(SRC_BVH_HEADERS
bvh/bvh_volume.h
bvh/bvh_volume_all.h
bvh/bvh_embree.h
)
set(SRC_HEADERS
kernel_accumulate.h
kernel_adaptive_sampling.h
kernel_bake.h
kernel_camera.h
kernel_color.h
kernel_differential.h
kernel_emission.h
kernel_film.h
kernel_id_passes.h
kernel_jitter.h
kernel_light.h
kernel_light_background.h
kernel_light_common.h
kernel_lookup_table.h
kernel_math.h
kernel_montecarlo.h
kernel_passes.h
kernel_path_state.h
kernel_profiling.h
kernel_projection.h
kernel_random.h
kernel_shader.h
kernel_shadow_catcher.h
camera/camera.h
camera/camera_projection.h
film/film_accumulate.h
film/film_adaptive_sampling.h
film/film_id_passes.h
film/film_passes.h
film/film_read.h
film/film_write_passes.h
integrator/integrator_path_state.h
integrator/integrator_shader_eval.h
integrator/integrator_shadow_catcher.h
kernel_textures.h
kernel_types.h
kernel_work_stealing.h
kernel_write_passes.h
light/light.h
light/light_background.h
light/light_common.h
light/light_sample.h
sample/sample_jitter.h
sample/sample_lcg.h
sample/sample_mapping.h
sample/sample_mis.h
sample/sample_pattern.h
util/util_color.h
util/util_differential.h
util/util_lookup_table.h
util/util_profiling.h
)
set(SRC_DEVICE_CPU_HEADERS
@ -102,6 +99,7 @@ set(SRC_DEVICE_GPU_HEADERS
device/gpu/parallel_prefix_sum.h
device/gpu/parallel_reduce.h
device/gpu/parallel_sorted_index.h
device/gpu/work_stealing.h
)
set(SRC_DEVICE_CUDA_HEADERS
@ -666,7 +664,7 @@ if(WITH_CYCLES_OSL)
cycles_kernel_osl
)
add_subdirectory(osl)
add_subdirectory(shaders)
add_subdirectory(osl/shaders)
endif()
# CPU module

View file

@ -16,9 +16,8 @@
#pragma once
#include "kernel/kernel_differential.h"
#include "kernel/kernel_projection.h"
#include "kernel/kernel_shader.h"
#include "kernel/camera/camera_projection.h"
#include "kernel/integrator/integrator_shader_eval.h"
#include "kernel/geom/geom.h"

View file

@ -16,10 +16,10 @@
#pragma once
#include "kernel_differential.h"
#include "kernel_lookup_table.h"
#include "kernel_montecarlo.h"
#include "kernel_projection.h"
#include "kernel/camera/camera_projection.h"
#include "kernel/sample/sample_mapping.h"
#include "kernel/util/util_differential.h"
#include "kernel/util/util_lookup_table.h"
CCL_NAMESPACE_BEGIN

View file

@ -32,7 +32,7 @@
#pragma once
#include "kernel/kernel_montecarlo.h"
#include "kernel/sample/sample_mapping.h"
CCL_NAMESPACE_BEGIN

View file

@ -32,6 +32,8 @@
#pragma once
#include "kernel/sample/sample_mapping.h"
CCL_NAMESPACE_BEGIN
typedef struct DiffuseBsdf {

View file

@ -32,6 +32,8 @@
#pragma once
#include "kernel/sample/sample_mapping.h"
CCL_NAMESPACE_BEGIN
#ifdef __OSL__

View file

@ -20,7 +20,7 @@
# include <fenv.h>
#endif
#include "kernel/kernel_color.h"
#include "kernel/util/util_color.h"
CCL_NAMESPACE_BEGIN

View file

@ -32,8 +32,8 @@
#pragma once
#include "kernel/kernel_lookup_table.h"
#include "kernel/kernel_random.h"
#include "kernel/sample/sample_pattern.h"
#include "kernel/util/util_lookup_table.h"
CCL_NAMESPACE_BEGIN

View file

@ -16,6 +16,9 @@
#pragma once
#include "kernel/sample/sample_lcg.h"
#include "kernel/sample/sample_mapping.h"
CCL_NAMESPACE_BEGIN
/* Most of the code is based on the supplemental implementations from

View file

@ -27,6 +27,8 @@
#include "kernel/closure/bsdf_util.h"
#include "kernel/sample/sample_mapping.h"
CCL_NAMESPACE_BEGIN
enum PrincipledDiffuseBsdfComponents {

View file

@ -148,4 +148,110 @@ interpolate_fresnel_color(float3 L, float3 H, float ior, float F0, float3 cspec0
return cspec0 * (1.0f - FH) + make_float3(1.0f, 1.0f, 1.0f) * FH;
}
ccl_device float3 ensure_valid_reflection(float3 Ng, float3 I, float3 N)
{
float3 R = 2 * dot(N, I) * N - I;
/* Reflection rays may always be at least as shallow as the incoming ray. */
float threshold = min(0.9f * dot(Ng, I), 0.01f);
if (dot(Ng, R) >= threshold) {
return N;
}
/* Form coordinate system with Ng as the Z axis and N inside the X-Z-plane.
* The X axis is found by normalizing the component of N that's orthogonal to Ng.
* The Y axis isn't actually needed.
*/
float NdotNg = dot(N, Ng);
float3 X = normalize(N - NdotNg * Ng);
/* Keep math expressions. */
/* clang-format off */
/* Calculate N.z and N.x in the local coordinate system.
*
* The goal of this computation is to find a N' that is rotated towards Ng just enough
* to lift R' above the threshold (here called t), therefore dot(R', Ng) = t.
*
* According to the standard reflection equation,
* this means that we want dot(2*dot(N', I)*N' - I, Ng) = t.
*
* Since the Z axis of our local coordinate system is Ng, dot(x, Ng) is just x.z, so we get
* 2*dot(N', I)*N'.z - I.z = t.
*
* The rotation is simple to express in the coordinate system we formed -
* since N lies in the X-Z-plane, we know that N' will also lie in the X-Z-plane,
* so N'.y = 0 and therefore dot(N', I) = N'.x*I.x + N'.z*I.z .
*
* Furthermore, we want N' to be normalized, so N'.x = sqrt(1 - N'.z^2).
*
* With these simplifications,
* we get the final equation 2*(sqrt(1 - N'.z^2)*I.x + N'.z*I.z)*N'.z - I.z = t.
*
* The only unknown here is N'.z, so we can solve for that.
*
* The equation has four solutions in general:
*
* N'.z = +-sqrt(0.5*(+-sqrt(I.x^2*(I.x^2 + I.z^2 - t^2)) + t*I.z + I.x^2 + I.z^2)/(I.x^2 + I.z^2))
* We can simplify this expression a bit by grouping terms:
*
* a = I.x^2 + I.z^2
* b = sqrt(I.x^2 * (a - t^2))
* c = I.z*t + a
* N'.z = +-sqrt(0.5*(+-b + c)/a)
*
* Two solutions can immediately be discarded because they're negative so N' would lie in the
* lower hemisphere.
*/
/* clang-format on */
float Ix = dot(I, X), Iz = dot(I, Ng);
float Ix2 = sqr(Ix), Iz2 = sqr(Iz);
float a = Ix2 + Iz2;
float b = safe_sqrtf(Ix2 * (a - sqr(threshold)));
float c = Iz * threshold + a;
/* Evaluate both solutions.
* In many cases one can be immediately discarded (if N'.z would be imaginary or larger than
* one), so check for that first. If no option is viable (might happen in extreme cases like N
* being in the wrong hemisphere), give up and return Ng. */
float fac = 0.5f / a;
float N1_z2 = fac * (b + c), N2_z2 = fac * (-b + c);
bool valid1 = (N1_z2 > 1e-5f) && (N1_z2 <= (1.0f + 1e-5f));
bool valid2 = (N2_z2 > 1e-5f) && (N2_z2 <= (1.0f + 1e-5f));
float2 N_new;
if (valid1 && valid2) {
/* If both are possible, do the expensive reflection-based check. */
float2 N1 = make_float2(safe_sqrtf(1.0f - N1_z2), safe_sqrtf(N1_z2));
float2 N2 = make_float2(safe_sqrtf(1.0f - N2_z2), safe_sqrtf(N2_z2));
float R1 = 2 * (N1.x * Ix + N1.y * Iz) * N1.y - Iz;
float R2 = 2 * (N2.x * Ix + N2.y * Iz) * N2.y - Iz;
valid1 = (R1 >= 1e-5f);
valid2 = (R2 >= 1e-5f);
if (valid1 && valid2) {
/* If both solutions are valid, return the one with the shallower reflection since it will be
* closer to the input (if the original reflection wasn't shallow, we would not be in this
* part of the function). */
N_new = (R1 < R2) ? N1 : N2;
}
else {
/* If only one reflection is valid (= positive), pick that one. */
N_new = (R1 > R2) ? N1 : N2;
}
}
else if (valid1 || valid2) {
/* Only one solution passes the N'.z criterium, so pick that one. */
float Nz2 = valid1 ? N1_z2 : N2_z2;
N_new = make_float2(safe_sqrtf(1.0f - Nz2), safe_sqrtf(Nz2));
}
else {
return Ng;
}
return N_new.x * X + N_new.y * Ng;
}
CCL_NAMESPACE_END

View file

@ -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

View file

@ -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) \

View file

@ -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

View file

@ -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.

View file

@ -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

View file

@ -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

View file

@ -16,10 +16,10 @@
#pragma once
#include "kernel_adaptive_sampling.h"
#include "kernel_random.h"
#include "kernel_shadow_catcher.h"
#include "kernel_write_passes.h"
#include "kernel/film/film_adaptive_sampling.h"
#include "kernel/film/film_write_passes.h"
#include "kernel/integrator/integrator_shadow_catcher.h"
CCL_NAMESPACE_BEGIN

View file

@ -16,7 +16,7 @@
#pragma once
#include "kernel/kernel_write_passes.h"
#include "kernel/film/film_write_passes.h"
CCL_NAMESPACE_BEGIN

View file

@ -18,8 +18,8 @@
#include "kernel/geom/geom.h"
#include "kernel/kernel_id_passes.h"
#include "kernel/kernel_write_passes.h"
#include "kernel/film/film_id_passes.h"
#include "kernel/film/film_write_passes.h"
CCL_NAMESPACE_BEGIN

View file

@ -26,6 +26,8 @@
#pragma once
#include "util/util_color.h"
CCL_NAMESPACE_BEGIN
typedef struct PatchHandle {

View file

@ -21,7 +21,7 @@
#pragma once
#include "kernel/kernel_projection.h"
#include "kernel/camera/camera_projection.h"
CCL_NAMESPACE_BEGIN

View file

@ -22,7 +22,7 @@
#pragma once
#include "kernel/kernel_random.h"
#include "kernel/sample/sample_lcg.h"
CCL_NAMESPACE_BEGIN

View file

@ -16,11 +16,14 @@
#pragma once
#include "kernel/kernel_accumulate.h"
#include "kernel/kernel_adaptive_sampling.h"
#include "kernel/kernel_camera.h"
#include "kernel/kernel_path_state.h"
#include "kernel/kernel_random.h"
#include "kernel/camera/camera.h"
#include "kernel/film/film_accumulate.h"
#include "kernel/film/film_adaptive_sampling.h"
#include "kernel/integrator/integrator_path_state.h"
#include "kernel/sample/sample_pattern.h"
#include "kernel/geom/geom.h"

View file

@ -16,12 +16,15 @@
#pragma once
#include "kernel/kernel_accumulate.h"
#include "kernel/kernel_adaptive_sampling.h"
#include "kernel/kernel_camera.h"
#include "kernel/kernel_path_state.h"
#include "kernel/kernel_random.h"
#include "kernel/kernel_shadow_catcher.h"
#include "kernel/camera/camera.h"
#include "kernel/film/film_accumulate.h"
#include "kernel/film/film_adaptive_sampling.h"
#include "kernel/integrator/integrator_path_state.h"
#include "kernel/integrator/integrator_shadow_catcher.h"
#include "kernel/sample/sample_pattern.h"
CCL_NAMESPACE_BEGIN

View file

@ -16,11 +16,14 @@
#pragma once
#include "kernel/kernel_differential.h"
#include "kernel/kernel_light.h"
#include "kernel/kernel_path_state.h"
#include "kernel/kernel_projection.h"
#include "kernel/kernel_shadow_catcher.h"
#include "kernel/camera/camera_projection.h"
#include "kernel/integrator/integrator_path_state.h"
#include "kernel/integrator/integrator_shadow_catcher.h"
#include "kernel/light/light.h"
#include "kernel/util/util_differential.h"
#include "kernel/geom/geom.h"

View file

@ -18,8 +18,8 @@
#include "kernel/bvh/bvh.h"
#include "kernel/geom/geom.h"
#include "kernel/integrator/integrator_shader_eval.h"
#include "kernel/integrator/integrator_volume_stack.h"
#include "kernel/kernel_shader.h"
CCL_NAMESPACE_BEGIN

View file

@ -16,7 +16,7 @@
#pragma once
#include "kernel_random.h"
#include "kernel/sample/sample_pattern.h"
CCL_NAMESPACE_BEGIN

View file

@ -16,10 +16,11 @@
#pragma once
#include "kernel/kernel_accumulate.h"
#include "kernel/kernel_emission.h"
#include "kernel/kernel_light.h"
#include "kernel/kernel_shader.h"
#include "kernel/film/film_accumulate.h"
#include "kernel/integrator/integrator_shader_eval.h"
#include "kernel/light/light.h"
#include "kernel/light/light_sample.h"
#include "kernel/sample/sample_mis.h"
CCL_NAMESPACE_BEGIN

View file

@ -16,10 +16,10 @@
#pragma once
#include "kernel/kernel_accumulate.h"
#include "kernel/kernel_emission.h"
#include "kernel/kernel_light.h"
#include "kernel/kernel_shader.h"
#include "kernel/film/film_accumulate.h"
#include "kernel/integrator/integrator_shader_eval.h"
#include "kernel/light/light.h"
#include "kernel/light/light_sample.h"
CCL_NAMESPACE_BEGIN

View file

@ -18,8 +18,7 @@
#include "kernel/integrator/integrator_shade_volume.h"
#include "kernel/integrator/integrator_volume_stack.h"
#include "kernel/kernel_shader.h"
#include "kernel/integrator/integrator_shader_eval.h"
CCL_NAMESPACE_BEGIN

View file

@ -16,16 +16,19 @@
#pragma once
#include "kernel/kernel_accumulate.h"
#include "kernel/kernel_emission.h"
#include "kernel/kernel_light.h"
#include "kernel/kernel_passes.h"
#include "kernel/kernel_path_state.h"
#include "kernel/kernel_shader.h"
#include "kernel/film/film_accumulate.h"
#include "kernel/film/film_passes.h"
#include "kernel/integrator/integrator_path_state.h"
#include "kernel/integrator/integrator_shader_eval.h"
#include "kernel/integrator/integrator_subsurface.h"
#include "kernel/integrator/integrator_volume_stack.h"
#include "kernel/light/light.h"
#include "kernel/light/light_sample.h"
#include "kernel/sample/sample_mis.h"
CCL_NAMESPACE_BEGIN
ccl_device_forceinline void integrate_surface_shader_setup(KernelGlobals kg,

View file

@ -16,16 +16,19 @@
#pragma once
#include "kernel/kernel_accumulate.h"
#include "kernel/kernel_emission.h"
#include "kernel/kernel_light.h"
#include "kernel/kernel_passes.h"
#include "kernel/kernel_path_state.h"
#include "kernel/kernel_shader.h"
#include "kernel/film/film_accumulate.h"
#include "kernel/film/film_passes.h"
#include "kernel/integrator/integrator_path_state.h"
#include "kernel/integrator/integrator_shader_eval.h"
#include "kernel/integrator/integrator_intersect_closest.h"
#include "kernel/integrator/integrator_volume_stack.h"
#include "kernel/light/light.h"
#include "kernel/light/light_sample.h"
#include "kernel/sample/sample_mis.h"
CCL_NAMESPACE_BEGIN
#ifdef __VOLUME__

Some files were not shown because too many files have changed in this diff Show more