Files
test/intern/cycles/blender/CMakeLists.txt
Hans Goudey 2fac2228d0 Cycles: Use Blender headers to access geometry data, avoid copy
Since 34b4487844, attributes are always made mutable when
accessed from the RNA API. This can result in unnecessary copies, which
increases memory usage and reduces performance.

Cycles is the only user of the C++ RNA API, which we'd like to remove
in the future since it doesn't really make sense in the big picture.
Hydra is now a better alternative for external render engines.

To start that change and fix the unnecessary copies, this commit
moves to use Blender headers directly for accessing attribute and
other geometry data. This also removes the few places that still had
overhead from the RNA API after the changes ([0]) in 3.6. In a simple
test with a large grid, I observed a 1.76x performance improvement,
from 1.04 to 0.59 seconds to extract the mesh data to Cycles.

[0]: https://wiki.blender.org/wiki/Reference/Release_Notes/3.6/Cycles#Performance

Pull Request: https://projects.blender.org/blender/blender/pulls/112306
2023-09-18 02:50:09 +02:00

147 lines
2.4 KiB
CMake

# SPDX-FileCopyrightText: 2011-2022 Blender Foundation
#
# SPDX-License-Identifier: Apache-2.0
set(INC
..
../../mikktspace
../../../source/blender/makesrna
../../../source/blender/blenkernel
../../../source/blender/gpu
../../../source/blender/render
${CMAKE_BINARY_DIR}/source/blender/makesrna/intern
)
set(INC_SYS
${Epoxy_INCLUDE_DIRS}
${PYTHON_INCLUDE_DIRS}
)
set(SRC
camera.cpp
device.cpp
display_driver.cpp
image.cpp
geometry.cpp
light.cpp
light_linking.cpp
mesh.cpp
object.cpp
object_cull.cpp
output_driver.cpp
particles.cpp
pointcloud.cpp
curves.cpp
logging.cpp
python.cpp
session.cpp
shader.cpp
sync.cpp
texture.cpp
viewport.cpp
volume.cpp
attribute_convert.h
CCL_api.h
device.h
display_driver.h
id_map.h
image.h
light_linking.h
object_cull.h
output_driver.h
sync.h
session.h
texture.h
util.h
viewport.h
)
set(LIB
PRIVATE bf::blenlib
PRIVATE bf::dna
PRIVATE bf::intern::guardedalloc
cycles_bvh
cycles_device
cycles_graph
cycles_kernel
cycles_scene
cycles_session
cycles_subd
cycles_util
bf_intern_mikktspace
${Epoxy_LIBRARIES}
${PYTHON_LINKFLAGS}
${PYTHON_LIBRARIES}
)
if(WITH_CYCLES_LOGGING)
list(APPEND LIB
${GLOG_LIBRARIES}
${GFLAGS_LIBRARIES}
)
endif()
set(ADDON_FILES
addon/__init__.py
addon/camera.py
addon/engine.py
addon/operators.py
addon/osl.py
addon/presets.py
addon/properties.py
addon/ui.py
addon/version_update.py
)
if(WITH_CYCLES_DEVICE_HIP)
add_definitions(-DWITH_HIP)
endif()
if(WITH_CYCLES_DEVICE_METAL)
add_definitions(-DWITH_METAL)
endif()
if(WITH_MOD_FLUID)
add_definitions(-DWITH_FLUID)
endif()
if(WITH_TBB)
add_definitions(-DWITH_TBB)
endif()
if(WITH_OPENVDB)
add_definitions(-DWITH_OPENVDB ${OPENVDB_DEFINITIONS})
list(APPEND INC_SYS
${OPENVDB_INCLUDE_DIRS}
)
list(APPEND LIB
${OPENVDB_LIBRARIES}
)
endif()
if(WITH_ALEMBIC)
add_definitions(-DWITH_ALEMBIC)
list(APPEND INC_SYS
${ALEMBIC_INCLUDE_DIRS}
)
list(APPEND LIB
${ALEMBIC_LIBRARIES}
)
endif()
if(WITH_OPENIMAGEDENOISE)
add_definitions(-DWITH_OPENIMAGEDENOISE)
list(APPEND INC_SYS
${OPENIMAGEDENOISE_INCLUDE_DIRS}
)
endif()
blender_add_lib(bf_intern_cycles "${SRC}" "${INC}" "${INC_SYS}" "${LIB}")
add_dependencies(bf_intern_cycles bf_rna)
delayed_install(${CMAKE_CURRENT_SOURCE_DIR} "${ADDON_FILES}" ${CYCLES_INSTALL_PATH})