2011-04-27 11:58:34 +00:00
|
|
|
|
2011-11-08 20:27:37 +00:00
|
|
|
set(INC
|
|
|
|
.
|
|
|
|
../util
|
|
|
|
osl
|
|
|
|
svm
|
|
|
|
)
|
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
|
|
|
|
|
|
|
set(SRC
|
2011-04-27 11:58:34 +00:00
|
|
|
kernel.cpp
|
2013-02-04 16:12:37 +00:00
|
|
|
kernel_sse2.cpp
|
|
|
|
kernel_sse3.cpp
|
2011-04-27 11:58:34 +00:00
|
|
|
kernel.cl
|
2011-11-08 20:27:37 +00:00
|
|
|
kernel.cu
|
|
|
|
)
|
2011-04-27 11:58:34 +00:00
|
|
|
|
2011-11-08 20:27:37 +00:00
|
|
|
set(SRC_HEADERS
|
2011-04-27 11:58:34 +00:00
|
|
|
kernel.h
|
Cycles: Render Passes
Currently supported passes:
* Combined, Z, Normal, Object Index, Material Index, Emission, Environment,
Diffuse/Glossy/Transmission x Direct/Indirect/Color
Not supported yet:
* UV, Vector, Mist
Only enabled for CPU devices at the moment, will do GPU tweaks tommorrow,
also for environment importance sampling.
Documentation:
http://wiki.blender.org/index.php/Doc:2.6/Manual/Render/Cycles/Passes
2012-01-25 17:23:52 +00:00
|
|
|
kernel_accumulate.h
|
2011-04-27 11:58:34 +00:00
|
|
|
kernel_bvh.h
|
2013-08-24 03:17:28 +00:00
|
|
|
kernel_bvh_subsurface.h
|
2013-04-17 20:07:22 +00:00
|
|
|
kernel_bvh_traversal.h
|
2011-04-27 11:58:34 +00:00
|
|
|
kernel_camera.h
|
|
|
|
kernel_compat_cpu.h
|
|
|
|
kernel_compat_cuda.h
|
|
|
|
kernel_compat_opencl.h
|
2013-01-03 12:08:54 +00:00
|
|
|
kernel_curve.h
|
2011-04-27 11:58:34 +00:00
|
|
|
kernel_differential.h
|
|
|
|
kernel_displace.h
|
|
|
|
kernel_emission.h
|
|
|
|
kernel_film.h
|
|
|
|
kernel_globals.h
|
2013-06-07 16:06:22 +00:00
|
|
|
kernel_jitter.h
|
2011-04-27 11:58:34 +00:00
|
|
|
kernel_light.h
|
|
|
|
kernel_math.h
|
|
|
|
kernel_montecarlo.h
|
|
|
|
kernel_object.h
|
Cycles: Render Passes
Currently supported passes:
* Combined, Z, Normal, Object Index, Material Index, Emission, Environment,
Diffuse/Glossy/Transmission x Direct/Indirect/Color
Not supported yet:
* UV, Vector, Mist
Only enabled for CPU devices at the moment, will do GPU tweaks tommorrow,
also for environment importance sampling.
Documentation:
http://wiki.blender.org/index.php/Doc:2.6/Manual/Render/Cycles/Passes
2012-01-25 17:23:52 +00:00
|
|
|
kernel_passes.h
|
2011-04-27 11:58:34 +00:00
|
|
|
kernel_path.h
|
2013-01-03 12:08:54 +00:00
|
|
|
kernel_primitive.h
|
2012-05-07 20:37:48 +00:00
|
|
|
kernel_projection.h
|
2011-04-27 11:58:34 +00:00
|
|
|
kernel_random.h
|
|
|
|
kernel_shader.h
|
2013-04-01 20:26:52 +00:00
|
|
|
kernel_subsurface.h
|
2011-05-20 12:26:01 +00:00
|
|
|
kernel_textures.h
|
2011-04-27 11:58:34 +00:00
|
|
|
kernel_triangle.h
|
2011-11-08 20:27:37 +00:00
|
|
|
kernel_types.h
|
|
|
|
)
|
2011-05-20 12:26:01 +00:00
|
|
|
|
2012-10-20 14:08:49 +00:00
|
|
|
set(SRC_CLOSURE_HEADERS
|
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
|
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
|
2012-10-20 12:18:00 +00:00
|
|
|
closure/bsdf_ward.h
|
|
|
|
closure/bsdf_westin.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
|
2012-10-20 14:08:49 +00:00
|
|
|
)
|
|
|
|
set(SRC_SVM_HEADERS
|
2011-04-27 11:58:34 +00:00
|
|
|
svm/svm.h
|
|
|
|
svm/svm_attribute.h
|
2013-06-15 23:47:09 +00:00
|
|
|
svm/svm_blackbody.h
|
2011-12-02 20:36:13 +00:00
|
|
|
svm/svm_camera.h
|
2011-04-27 11:58:34 +00:00
|
|
|
svm/svm_closure.h
|
|
|
|
svm/svm_convert.h
|
2012-01-08 14:55:43 +00:00
|
|
|
svm/svm_checker.h
|
2012-09-04 13:29:07 +00:00
|
|
|
svm/svm_brick.h
|
2011-04-27 11:58:34 +00:00
|
|
|
svm/svm_displace.h
|
|
|
|
svm/svm_fresnel.h
|
2013-05-20 15:58:37 +00:00
|
|
|
svm/svm_wireframe.h
|
2013-06-09 20:46:22 +00:00
|
|
|
svm/svm_wavelength.h
|
2011-12-16 20:35:06 +00:00
|
|
|
svm/svm_gamma.h
|
2012-01-24 16:32:31 +00:00
|
|
|
svm/svm_brightness.h
|
2011-04-27 11:58:34 +00:00
|
|
|
svm/svm_geometry.h
|
2011-11-06 21:05:58 +00:00
|
|
|
svm/svm_gradient.h
|
2011-12-02 16:57:37 +00:00
|
|
|
svm/svm_hsv.h
|
2011-04-27 11:58:34 +00:00
|
|
|
svm/svm_image.h
|
2011-12-03 23:05:35 +00:00
|
|
|
svm/svm_invert.h
|
2011-04-27 11:58:34 +00:00
|
|
|
svm/svm_light_path.h
|
|
|
|
svm/svm_magic.h
|
|
|
|
svm/svm_mapping.h
|
|
|
|
svm/svm_math.h
|
|
|
|
svm/svm_mix.h
|
|
|
|
svm/svm_musgrave.h
|
|
|
|
svm/svm_noise.h
|
|
|
|
svm/svm_noisetex.h
|
2011-12-16 18:15:07 +00:00
|
|
|
svm/svm_normal.h
|
2012-03-26 12:45:14 +00:00
|
|
|
svm/svm_ramp.h
|
2011-12-01 21:46:10 +00:00
|
|
|
svm/svm_sepcomb_rgb.h
|
2013-07-03 23:46:56 +00:00
|
|
|
svm/svm_sepcomb_hsv.h
|
2011-04-27 11:58:34 +00:00
|
|
|
svm/svm_sky.h
|
|
|
|
svm/svm_tex_coord.h
|
|
|
|
svm/svm_texture.h
|
|
|
|
svm/svm_types.h
|
|
|
|
svm/svm_value.h
|
2013-06-23 17:51:08 +00:00
|
|
|
svm/svm_vector_transform.h
|
2011-04-27 11:58:34 +00:00
|
|
|
svm/svm_voronoi.h
|
2011-11-06 21:05:58 +00:00
|
|
|
svm/svm_wave.h
|
2011-11-08 20:27:37 +00:00
|
|
|
)
|
2011-04-27 11:58:34 +00:00
|
|
|
|
2011-11-08 20:27:37 +00:00
|
|
|
set(SRC_UTIL_HEADERS
|
2011-08-11 12:36:08 +00:00
|
|
|
../util/util_color.h
|
|
|
|
../util/util_math.h
|
|
|
|
../util/util_transform.h
|
2011-11-08 20:27:37 +00:00
|
|
|
../util/util_types.h
|
|
|
|
)
|
2011-11-10 12:52:17 +00:00
|
|
|
# CUDA module
|
|
|
|
|
|
|
|
if(WITH_CYCLES_CUDA_BINARIES)
|
2013-06-19 17:54:23 +00:00
|
|
|
# 32 bit or 64 bit
|
2011-11-10 12:52:17 +00:00
|
|
|
if("${CMAKE_SIZEOF_VOID_P}" EQUAL "8")
|
|
|
|
set(CUDA_BITS 64)
|
|
|
|
else()
|
|
|
|
set(CUDA_BITS 32)
|
|
|
|
endif()
|
|
|
|
|
2013-06-19 17:54:23 +00:00
|
|
|
# CUDA version
|
|
|
|
execute_process (COMMAND ${CUDA_NVCC_EXECUTABLE} "--version" OUTPUT_VARIABLE NVCC_OUT)
|
|
|
|
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})
|
|
|
|
set(CUDA_VERSION "${CUDA_VERSION_MAJOR}${CUDA_VERSION_MINOR}")
|
|
|
|
|
2013-06-20 13:10:47 +00:00
|
|
|
# warn for other versions
|
|
|
|
if(CUDA_VERSION MATCHES "50")
|
|
|
|
else()
|
|
|
|
message(WARNING "CUDA version ${CUDA_VERSION_MAJOR}.${CUDA_VERSION_MINOR} detected, build may succeed but only CUDA 5.0 is officially supported")
|
|
|
|
endif()
|
|
|
|
|
2013-06-19 17:54:23 +00:00
|
|
|
# build for each arch
|
2012-10-20 14:08:49 +00:00
|
|
|
set(cuda_sources kernel.cu ${SRC_HEADERS} ${SRC_SVM_HEADERS} ${SRC_CLOSURE_HEADERS} ${SRC_UTIL_HEADERS})
|
2011-11-10 12:52:17 +00:00
|
|
|
set(cuda_cubins)
|
|
|
|
|
|
|
|
foreach(arch ${CYCLES_CUDA_BINARIES_ARCH})
|
|
|
|
set(cuda_cubin kernel_${arch}.cubin)
|
|
|
|
|
2013-06-19 17:54:23 +00:00
|
|
|
set(cuda_version_flags "-D__KERNEL_CUDA_VERSION__=${CUDA_VERSION}")
|
|
|
|
|
|
|
|
# build flags depending on CUDA version and arch
|
|
|
|
if(CUDA_VERSION LESS 50)
|
|
|
|
# CUDA 4.x
|
|
|
|
if(${arch} MATCHES "sm_1[0-9]")
|
|
|
|
# sm_1x
|
|
|
|
set(cuda_arch_flags "--maxrregcount=24 --opencc-options -OPT:Olimit=0")
|
|
|
|
elseif(${arch} MATCHES "sm_2[0-9]")
|
|
|
|
# sm_2x
|
|
|
|
set(cuda_arch_flags "--maxrregcount=24")
|
|
|
|
else()
|
|
|
|
# sm_3x
|
|
|
|
set(cuda_arch_flags "--maxrregcount=32")
|
|
|
|
endif()
|
|
|
|
|
|
|
|
set(cuda_math_flags "")
|
|
|
|
else()
|
|
|
|
# CUDA 5.x
|
|
|
|
if(${arch} MATCHES "sm_1[0-9]")
|
|
|
|
# sm_1x
|
|
|
|
set(cuda_arch_flags "--maxrregcount=24 --opencc-options -OPT:Olimit=0")
|
|
|
|
elseif(${arch} MATCHES "sm_2[0-9]")
|
|
|
|
# sm_2x
|
|
|
|
set(cuda_arch_flags "--maxrregcount=32")
|
|
|
|
else()
|
|
|
|
# sm_3x
|
|
|
|
set(cuda_arch_flags "--maxrregcount=32")
|
|
|
|
endif()
|
|
|
|
|
|
|
|
set(cuda_math_flags "--use_fast_math")
|
2013-06-11 21:58:48 +00:00
|
|
|
endif()
|
|
|
|
|
2013-06-20 13:10:47 +00:00
|
|
|
if(CUDA_VERSION LESS 50 AND ${arch} MATCHES "sm_35")
|
|
|
|
message(WARNING "Can't build kernel for CUDA sm_35 architecture, skipping")
|
|
|
|
else()
|
|
|
|
add_custom_command(
|
|
|
|
OUTPUT ${cuda_cubin}
|
|
|
|
COMMAND ${CUDA_NVCC_EXECUTABLE} -arch=${arch} -m${CUDA_BITS} --cubin ${CMAKE_CURRENT_SOURCE_DIR}/kernel.cu -o ${CMAKE_CURRENT_BINARY_DIR}/${cuda_cubin} --ptxas-options="-v" ${cuda_arch_flags} ${cuda_version_flags} ${cuda_math_flags} -I${CMAKE_CURRENT_SOURCE_DIR}/../util -I${CMAKE_CURRENT_SOURCE_DIR}/svm -DCCL_NAMESPACE_BEGIN= -DCCL_NAMESPACE_END= -DNVCC
|
|
|
|
DEPENDS ${cuda_sources})
|
2011-11-10 12:52:17 +00:00
|
|
|
|
2013-06-20 13:10:47 +00:00
|
|
|
delayed_install("${CMAKE_CURRENT_BINARY_DIR}" "${cuda_cubin}" ${CYCLES_INSTALL_PATH}/lib)
|
|
|
|
list(APPEND cuda_cubins ${cuda_cubin})
|
|
|
|
endif()
|
2011-11-10 12:52:17 +00:00
|
|
|
endforeach()
|
|
|
|
|
|
|
|
add_custom_target(cycles_kernel_cuda ALL DEPENDS ${cuda_cubins})
|
|
|
|
endif()
|
2011-08-11 12:36:08 +00:00
|
|
|
|
2011-04-27 11:58:34 +00:00
|
|
|
# OSL module
|
|
|
|
|
2011-08-16 16:15:34 +00:00
|
|
|
if(WITH_CYCLES_OSL)
|
|
|
|
add_subdirectory(osl)
|
2012-11-03 14:32:13 +00:00
|
|
|
add_subdirectory(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
|
|
|
|
2012-10-20 14:08:49 +00:00
|
|
|
add_library(cycles_kernel ${SRC} ${SRC_HEADERS} ${SRC_CLOSURE_HEADERS} ${SRC_SVM_HEADERS})
|
2011-04-28 13:47:27 +00:00
|
|
|
|
2011-11-15 15:13:38 +00:00
|
|
|
if(WITH_CYCLES_OPTIMIZED_KERNEL)
|
2013-02-04 16:12:37 +00:00
|
|
|
set_source_files_properties(kernel_sse2.cpp PROPERTIES COMPILE_FLAGS "${CYCLES_SSE2_KERNEL_FLAGS}")
|
|
|
|
set_source_files_properties(kernel_sse3.cpp PROPERTIES COMPILE_FLAGS "${CYCLES_SSE3_KERNEL_FLAGS}")
|
2011-11-15 15:13:38 +00:00
|
|
|
endif()
|
|
|
|
|
2011-08-16 16:15:34 +00:00
|
|
|
if(WITH_CYCLES_CUDA)
|
|
|
|
add_dependencies(cycles_kernel cycles_kernel_cuda)
|
|
|
|
endif()
|
2011-04-27 11:58:34 +00:00
|
|
|
|
2011-11-15 15:13:38 +00:00
|
|
|
# OpenCL kernel
|
2011-05-20 12:26:01 +00:00
|
|
|
|
2011-11-08 20:27:37 +00:00
|
|
|
#set(KERNEL_PREPROCESSED ${CMAKE_CURRENT_BINARY_DIR}/kernel_preprocessed.cl)
|
2011-09-02 14:55:06 +00:00
|
|
|
#add_custom_command(
|
2011-11-08 20:27:37 +00:00
|
|
|
# OUTPUT ${KERNEL_PREPROCESSED}
|
2011-12-20 17:36:56 +00:00
|
|
|
# COMMAND gcc -x c++ -E ${CMAKE_CURRENT_SOURCE_DIR}/kernel.cl -I ${CMAKE_CURRENT_SOURCE_DIR}/../util/ -DCCL_NAMESPACE_BEGIN= -DCCL_NAMESPACE_END= -o ${KERNEL_PREPROCESSED}
|
2011-11-08 20:27:37 +00:00
|
|
|
# DEPENDS ${SRC_KERNEL} ${SRC_UTIL_HEADERS})
|
|
|
|
#add_custom_target(cycles_kernel_preprocess ALL DEPENDS ${KERNEL_PREPROCESSED})
|
|
|
|
#delayed_install(${CMAKE_CURRENT_SOURCE_DIR} "${KERNEL_PREPROCESSED}" ${CYCLES_INSTALL_PATH}/kernel)
|
2011-09-02 14:55:06 +00:00
|
|
|
|
|
|
|
delayed_install(${CMAKE_CURRENT_SOURCE_DIR} "kernel.cl" ${CYCLES_INSTALL_PATH}/kernel)
|
2011-09-09 12:04:39 +00:00
|
|
|
delayed_install(${CMAKE_CURRENT_SOURCE_DIR} "kernel.cu" ${CYCLES_INSTALL_PATH}/kernel)
|
2011-11-08 20:27:37 +00:00
|
|
|
delayed_install(${CMAKE_CURRENT_SOURCE_DIR} "${SRC_HEADERS}" ${CYCLES_INSTALL_PATH}/kernel)
|
2012-10-20 14:08:49 +00:00
|
|
|
delayed_install(${CMAKE_CURRENT_SOURCE_DIR} "${SRC_CLOSURE_HEADERS}" ${CYCLES_INSTALL_PATH}/kernel/closure)
|
2011-11-08 20:27:37 +00:00
|
|
|
delayed_install(${CMAKE_CURRENT_SOURCE_DIR} "${SRC_SVM_HEADERS}" ${CYCLES_INSTALL_PATH}/kernel/svm)
|
|
|
|
delayed_install(${CMAKE_CURRENT_SOURCE_DIR} "${SRC_UTIL_HEADERS}" ${CYCLES_INSTALL_PATH}/kernel)
|
2011-11-15 15:13:38 +00:00
|
|
|
|