1
1

Compare commits

..

11 Commits

Author SHA1 Message Date
58d6cbba6d Merge branch 'master' into temp-ghash-setops 2015-06-29 17:10:42 +02:00
94549adec4 Merge branch 'master' into temp-ghash-setops 2015-03-21 09:07:10 +01:00
77a4d705c7 Merge branch 'master' into temp-ghash-setops 2015-03-20 16:56:12 +01:00
f808f36c12 Get rid of varargs in union & co functions (using variadic macros instead). 2015-03-20 16:55:10 +01:00
b6f0c9e25a Some improvements/tweaks from review. 2015-03-20 15:15:26 +01:00
ecc9fe9945 Merge branch 'master' into temp-ghash-setops 2015-03-20 12:54:41 +01:00
4e3bc21492 Remove public GHash API for union/inter/diff/symmdiff.
This is dead easy to add back when we want (or use other naming if we really
like them better), core code remains exactly the same anyway.

Note we keep checks (isdisjoint, isequal, etc.) for ghashes though, those are
pure-keys non-modifying operations anyway, so here set ops for ghash are
definitively valid (equivalent of set ops on dict.keys() views in py).
2015-03-20 12:04:03 +01:00
88ae44a363 Fix for updates in master... 2015-03-20 12:04:03 +01:00
df587b03c3 Revert "Remove gtests."
This reverts commit 2b8fac2a153e135d0f6cc7621a3755901477fd3d.
2015-03-20 12:04:03 +01:00
1df3713365 Remove gtests. 2015-03-20 12:04:03 +01:00
23b42a5e69 Squashed commit of temp-ghash-experiments, minus the 'hash storage' part. 2015-03-20 12:04:03 +01:00
1042 changed files with 23146 additions and 46990 deletions

View File

@@ -158,30 +158,25 @@ option_defaults_init(
_init_SDL
_init_FFTW3
_init_GAMEENGINE
_init_OPENSUBDIV
)
# customize...
if (UNIX AND NOT APPLE)
if(UNIX AND NOT APPLE)
# some of these libraries are problematic on Linux
# disable less important dependencies by default
set(_init_BUILDINFO OFF)
set(_init_CODEC_FFMPEG OFF)
set(_init_CYCLES_OSL OFF)
set(_init_IMAGE_OPENEXR OFF)
set(_init_IMAGE_REDCODE OFF)
set(_init_INPUT_NDOF OFF)
set(_init_JACK OFF)
set(_init_LIBMV_SCHUR_SPECIALIZATION OFF)
set(_init_OPENCOLLADA OFF)
set(_init_OPENCOLORIO OFF)
set(_init_SDL OFF)
set(_init_FFTW3 OFF)
set(_init_OPENSUBDIV OFF)
elseif(WIN32)
set(_init_JACK OFF)
elseif(APPLE)
set(_init_INPUT_NDOF OFF)
set(_init_JACK OFF)
set(_init_OPENSUBDIV OFF)
set(_init_GAMEENGINE OFF)
endif()
@@ -226,15 +221,7 @@ mark_as_advanced(WITH_SYSTEM_BULLET)
option(WITH_GAMEENGINE "Enable Game Engine" ${_init_GAMEENGINE})
option(WITH_PLAYER "Build Player" OFF)
option(WITH_OPENCOLORIO "Enable OpenColorIO color management" ${_init_OPENCOLORIO})
# Compositor
option(WITH_COMPOSITOR "Enable the tile based nodal compositor" ON)
option(WITH_COMPOSITOR_WERROR "Treat warnings as errors in compositor code" OFF)
mark_as_advanced(WITH_COMPOSITOR_WERROR)
option(WITH_OPENSUBDIV "Enable OpenSubdiv for surface subdivision" _init_OPENSUBDIV)
option(WITH_SUBSURF_WERROR "Treat warnings as errors in subsurf code" OFF)
mark_as_advanced(WITH_COMPOSITOR_WERROR)
option(WITH_COMPOSITOR "Enable the tile based nodal compositor" ON)
# GHOST Windowing Library Options
option(WITH_GHOST_DEBUG "Enable debugging output for the GHOST library" OFF)
@@ -252,13 +239,7 @@ option(WITH_HEADLESS "Build without graphical support (renderfarm, server m
mark_as_advanced(WITH_HEADLESS)
option(WITH_AUDASPACE "Build with blenders audio library (only disable if you know what you're doing!)" ON)
option(WITH_SYSTEM_AUDASPACE "Build with external audaspace library installed on the system (only enable if you know what you're doing!)" OFF)
mark_as_advanced(WITH_AUDASPACE)
mark_as_advanced(WITH_SYSTEM_AUDASPACE)
if(NOT WITH_AUDASPACE)
set(WITH_SYSTEM_AUDASPACE OFF)
endif()
option(WITH_OPENMP "Enable OpenMP (has to be supported by the compiler)" ON)
@@ -337,11 +318,9 @@ if(UNIX AND NOT APPLE)
endif()
# Camera/motion tracking
option(WITH_LIBMV "Enable Libmv structure from motion library" ON)
option(WITH_LIBMV "Enable libmv structure from motion library" ON)
option(WITH_LIBMV_SCHUR_SPECIALIZATIONS "Enable fixed-size schur specializations." ${_init_LIBMV_SCHUR_SPECIALIZATION})
option(WITH_LIBMV_WERROR "Treat warnings as errors in Libmv (and Blender's motion tracking) code")
mark_as_advanced(WITH_LIBMV_SCHUR_SPECIALIZATIONS)
mark_as_advanced(WITH_LIBMV_WERROR)
# Freestyle
option(WITH_FREESTYLE "Enable Freestyle (advanced edges rendering)" ON)
@@ -375,20 +354,18 @@ if(UNIX AND NOT APPLE)
endif()
# Cycles
option(WITH_CYCLES "Enable Cycles Render Engine" ON)
option(WITH_CYCLES_STANDALONE "Build Cycles standalone application" OFF)
option(WITH_CYCLES_STANDALONE_GUI "Build Cycles standalone with GUI" OFF)
option(WITH_CYCLES "Enable cycles Render Engine" ON)
option(WITH_CYCLES_STANDALONE "Build cycles standalone application" OFF)
option(WITH_CYCLES_STANDALONE_GUI "Build cycles standalone with GUI" OFF)
option(WITH_CYCLES_OSL "Build Cycles with OSL support" ${_init_CYCLES_OSL})
option(WITH_CYCLES_CUDA_BINARIES "Build Cycles CUDA binaries" OFF)
option(WITH_CYCLES_CUDA_BINARIES "Build cycles CUDA binaries" OFF)
set(CYCLES_CUDA_BINARIES_ARCH sm_20 sm_21 sm_30 sm_35 sm_50 sm_52 CACHE STRING "CUDA architectures to build binaries for")
mark_as_advanced(CYCLES_CUDA_BINARIES_ARCH)
unset(PLATFORM_DEFAULT)
option(WITH_CYCLES_LOGGING "Build Cycles with logging support" ON)
option(WITH_CYCLES_DEBUG "Build Cycles with extra debug capabilities" OFF)
option(WITH_CYCLES_WERROR "Treat warnings as errors in Cycles code" OFF)
option(WITH_CYCLES_LOGGING "Build cycles with logging support" ON)
option(WITH_CYCLES_DEBUG "Build cycles with extra debug capabilities" OFF)
mark_as_advanced(WITH_CYCLES_LOGGING)
mark_as_advanced(WITH_CYCLES_DEBUG)
mark_as_advanced(WITH_CYCLES_WERROR)
# LLVM
option(WITH_LLVM "Use LLVM" OFF)
@@ -418,6 +395,7 @@ option(WITH_BOOST "Enable features depending on boost" ON)
# Unit testsing
option(WITH_GTESTS "Enable GTest unit testing" OFF)
option(WITH_TESTS_PERFORMANCE "Enable performance tests" OFF)
# Documentation
@@ -434,6 +412,7 @@ option(WITH_GL_EGL "Use the EGL OpenGL system library instead of th
option(WITH_GL_PROFILE_COMPAT "Support using the OpenGL 'compatibility' profile. (deprecated)" ON )
option(WITH_GL_PROFILE_CORE "Support using the OpenGL 3.2+ 'core' profile." OFF)
option(WITH_GL_PROFILE_ES20 "Support using OpenGL ES 2.0. (thru either EGL or the AGL/WGL/XGL 'es20' profile)" OFF)
option(WITH_GPU_DEBUG "Create a debug OpenGL context (allows inserting custom messages and getting notifications for bad GL use)" OFF)
mark_as_advanced(
WITH_GLEW_MX
@@ -442,6 +421,7 @@ mark_as_advanced(
WITH_GL_PROFILE_COMPAT
WITH_GL_PROFILE_CORE
WITH_GL_PROFILE_ES20
WITH_GPU_DEBUG
)
if(WITH_GL_PROFILE_COMPAT)
@@ -717,34 +697,6 @@ if(HAVE_STDBOOL_H)
add_definitions(-DHAVE_STDBOOL_H)
endif()
if(WITH_AUDASPACE)
if(WITH_SYSTEM_AUDASPACE)
set(AUDASPACE_DEFINITIONS
-DWITH_AUDASPACE
-DWITH_SYSTEM_AUDASPACE
"-DAUD_DEVICE_H=<AUD_Device.h>"
"-DAUD_SPECIAL_H=<AUD_Special.h>"
"-DAUD_SOUND_H=<AUD_Sound.h>"
"-DAUD_HANDLE_H=<AUD_Handle.h>"
"-DAUD_SEQUENCE_H=<AUD_Sequence.h>"
"-DAUD_TYPES_H=<AUD_Types.h>"
"-DAUD_PYTHON_H=<python/PyAPI.h>"
)
else()
set(AUDASPACE_C_INCLUDE_DIRS "${CMAKE_SOURCE_DIR}/intern/audaspace/intern")
set(AUDASPACE_PY_INCLUDE_DIRS "${CMAKE_SOURCE_DIR}/intern/audaspace/intern")
set(AUDASPACE_DEFINITIONS
-DWITH_AUDASPACE
"-DAUD_DEVICE_H=<AUD_C-API.h>"
"-DAUD_SPECIAL_H=<AUD_C-API.h>"
"-DAUD_SOUND_H=<AUD_C-API.h>"
"-DAUD_HANDLE_H=<AUD_C-API.h>"
"-DAUD_SEQUENCE_H=<AUD_C-API.h>"
"-DAUD_TYPES_H=<AUD_Space.h>"
)
endif()
endif()
#-----------------------------------------------------------------------------
# Check for valid directories
# ... a partial checkout may cause this.
@@ -846,14 +798,6 @@ if(WITH_X11)
endif()
# ----------------------------------------------------------------------------
# Main Platform Checks
#
# - UNIX
# - WIN32
# - APPLE
if(UNIX AND NOT APPLE)
macro(find_package_wrapper)
if(WITH_STATIC_LIBS)
@@ -922,13 +866,6 @@ if(UNIX AND NOT APPLE)
endif()
# Audio IO
if(WITH_SYSTEM_AUDASPACE)
find_package_wrapper(Audaspace)
if(NOT AUDASPACE_FOUND OR NOT AUDASPACE_C_FOUND)
message(FATAL_ERROR "Audaspace external library not found!")
endif()
endif()
if(WITH_OPENAL)
find_package_wrapper(OpenAL)
if(NOT OPENAL_FOUND)
@@ -1129,9 +1066,9 @@ if(UNIX AND NOT APPLE)
endif()
if(WITH_LLVM)
find_package_wrapper(LLVM)
find_package_wrapper(LLVM)
if(NOT LLVM_FOUND)
if(NOT LLVM_FOUND)
set(WITH_LLVM OFF)
message(STATUS "LLVM not found")
endif()
@@ -1142,18 +1079,6 @@ if(UNIX AND NOT APPLE)
set(PLATFORM_LINKFLAGS "${PLATFORM_LINKFLAGS} -Wl,--version-script='${CMAKE_SOURCE_DIR}/source/creator/blender.map'")
endif()
if(WITH_OPENSUBDIV)
find_package_wrapper(OpenSubdiv)
set(OPENSUBDIV_LIBRARIES ${OPENSUBDIV_LIBRARIES})
set(OPENSUBDIV_LIBPATH) # TODO, remove and reference the absolute path everywhere
if(NOT OPENSUBDIV_FOUND)
set(WITH_OPENSUBDIV OFF)
message(STATUS "OpenSubdiv not found")
endif()
endif()
# OpenSuse needs lutil, ArchLinux not, for now keep, can avoid by using --as-needed
list(APPEND PLATFORM_LINKLIBS -lutil -lc -lm)
@@ -1191,12 +1116,12 @@ if(UNIX AND NOT APPLE)
execute_process(
COMMAND ${CMAKE_C_COMPILER} -fuse-ld=gold -Wl,--version
ERROR_QUIET OUTPUT_VARIABLE LD_VERSION)
if("${LD_VERSION}" MATCHES "GNU gold")
if ("${LD_VERSION}" MATCHES "GNU gold")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fuse-ld=gold")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fuse-ld=gold")
else()
message(STATUS "GNU gold linker isn't available, using the default system linker.")
endif()
else ()
message(INFO "GNU gold linker isn't available, using the default system linker.")
endif ()
unset(LD_VERSION)
# CLang is the same as GCC for now.
@@ -1574,13 +1499,6 @@ elseif(WIN32)
)
endif()
if(WITH_OPENSUBDIV)
set(OPENSUBDIV_INCLUDE_DIR ${LIBDIR}/opensubdiv/include)
set(OPENSUBDIV_LIBPATH ${LIBDIR}/opensubdiv/lib)
set(OPENSUBDIV_LIBRARIES ${OPENSUBDIV_LIBPATH}/osdCPU.lib ${OPENSUBDIV_LIBPATH}/osdGPU.lib)
find_package(OpenSubdiv)
endif()
if(WITH_SDL)
set(SDL ${LIBDIR}/sdl)
set(SDL_INCLUDE_DIR ${SDL}/include)
@@ -1588,16 +1506,6 @@ elseif(WIN32)
set(SDL_LIBPATH ${SDL}/lib)
endif()
# Audio IO
if(WITH_SYSTEM_AUDASPACE)
set(AUDASPACE_INCLUDE_DIRS ${LIBDIR}/audaspace/include/audaspace)
set(AUDASPACE_LIBRARIES ${LIBDIR}/audaspace/lib/audaspace.lib)
set(AUDASPACE_C_INCLUDE_DIRS ${LIBDIR}/audaspace/include/audaspace)
set(AUDASPACE_C_LIBRARIES ${LIBDIR}/audaspace/lib/audaspace-c.lib)
set(AUDASPACE_PY_INCLUDE_DIRS ${LIBDIR}/audaspace/include/audaspace)
set(AUDASPACE_PY_LIBRARIES ${LIBDIR}/audaspace/lib/audaspace-py.lib)
endif()
# used in many places so include globally, like OpenGL
blender_include_dirs_sys("${PTHREADS_INCLUDE_DIRS}")
@@ -1917,17 +1825,6 @@ elseif(APPLE)
endif()
endif()
if(WITH_OPENSUBDIV)
set(OPENSUBDIV ${LIBDIR}/opensubdiv)
set(OPENSUBDIV_LIBPATH ${OPENSUBDIV}/lib)
find_library(OSL_LIB_UTIL NAMES osdutil PATHS ${OPENSUBDIV_LIBPATH})
find_library(OSL_LIB_CPU NAMES osdCPU PATHS ${OPENSUBDIV_LIBPATH})
find_library(OSL_LIB_GPU NAMES osdGPU PATHS ${OPENSUBDIV_LIBPATH})
set(OPENSUBDIV_INCLUDE_DIR ${OPENSUBDIV}/include)
set(OPENSUBDIV_INCLUDE_DIRS ${OPENSUBDIV_INCLUDE_DIR})
list(APPEND OPENSUBDIV_LIBRARIES ${OSL_LIB_UTIL} ${OSL_LIB_CPU} ${OSL_LIB_GPU})
endif()
if(WITH_JACK)
find_library(JACK_FRAMEWORK
NAMES jackmp
@@ -2455,6 +2352,10 @@ if(WITH_GL_EGL)
list(APPEND GL_DEFINITIONS -DWITH_EGL)
endif()
if(WITH_GPU_DEBUG)
list(APPEND GL_DEFINITIONS -DWITH_GPU_DEBUG)
endif()
#-----------------------------------------------------------------------------
# Configure OpenMP.
if(WITH_OPENMP)
@@ -2962,6 +2863,7 @@ if(FIRST_RUN)
info_cfg_option(WITH_GL_PROFILE_COMPAT)
info_cfg_option(WITH_GL_PROFILE_CORE)
info_cfg_option(WITH_GL_PROFILE_ES20)
info_cfg_option(WITH_GPU_DEBUG)
if(WIN32)
info_cfg_option(WITH_GL_ANGLE)
endif()

View File

@@ -514,10 +514,6 @@ if env['WITH_BF_STATICCXX']:
else:
print '\tcould not remove stdc++ library from LLIBS, WITH_BF_STATICCXX may not work for your platform'
# audaspace is needed for the game engine
if not env['WITH_BF_AUDASPACE']:
env['WITH_BF_GAMEENGINE'] = False
# check target for blenderplayer. Set WITH_BF_PLAYER if found on cmdline
if 'blenderplayer' in B.targets:
env['WITH_BF_PLAYER'] = True
@@ -544,25 +540,13 @@ else:
env['CPPFLAGS'].append('-D__LITTLE_ENDIAN__')
# TODO, make optional (as with CMake)
env['CPPFLAGS'].append('-DWITH_AUDASPACE')
env['CPPFLAGS'].append('-DWITH_AVI')
env['CPPFLAGS'].append('-DWITH_OPENNL')
if env['OURPLATFORM'] not in ('win32-vc', 'win64-vc'):
env['CPPFLAGS'].append('-DHAVE_STDBOOL_H')
# Audaspace
if env['WITH_BF_AUDASPACE']:
env['BF_AUDASPACE_C_INC'] = '#intern/audaspace/intern'
env['BF_AUDASPACE_PY_INC'] = '#intern/audaspace/intern'
env['BF_AUDASPACE_DEF'] = ['WITH_AUDASPACE']
env['BF_AUDASPACE_DEF'].append('AUD_DEVICE_H="<AUD_C-API.h>"')
env['BF_AUDASPACE_DEF'].append('AUD_SPECIAL_H="<AUD_C-API.h>"')
env['BF_AUDASPACE_DEF'].append('AUD_SOUND_H="<AUD_C-API.h>"')
env['BF_AUDASPACE_DEF'].append('AUD_HANDLE_H="<AUD_C-API.h>"')
env['BF_AUDASPACE_DEF'].append('AUD_SEQUENCE_H="<AUD_C-API.h>"')
env['BF_AUDASPACE_DEF'].append('AUD_TYPES_H="<AUD_Space.h>"')
# OpenGL
if env['WITH_BF_GL_PROFILE_COMPAT']:
@@ -782,8 +766,6 @@ if B.targets != ['cudakernels']:
data_to_c_simple("release/datafiles/preview_cycles.blend")
# --- glsl ---
data_to_c_simple("source/blender/gpu/shaders/gpu_shader_geometry.glsl")
data_to_c_simple("source/blender/gpu/shaders/gpu_program_smoke_frag.glsl")
data_to_c_simple("source/blender/gpu/shaders/gpu_program_smoke_color_frag.glsl")
@@ -807,7 +789,6 @@ if B.targets != ['cudakernels']:
data_to_c_simple("source/blender/gpu/shaders/gpu_shader_fx_depth_resolve.glsl")
data_to_c_simple("source/blender/gpu/shaders/gpu_shader_fx_vert.glsl")
data_to_c_simple("intern/opencolorio/gpu_shader_display_transform.glsl")
data_to_c_simple("intern/opensubdiv/gpu_shader_opensubd_display.glsl")
# --- blender ---
data_to_c_simple("release/datafiles/bfont.pfb")

View File

@@ -27,10 +27,9 @@ getopt \
-o s:i:t:h \
--long source:,install:,tmp:,info:,threads:,help,no-sudo,with-all,with-opencollada,\
ver-ocio:,ver-oiio:,ver-llvm:,ver-osl:,\
force-all,force-python,force-numpy,force-boost,force-ocio,force-oiio,force-llvm,force-osl,force-osd,\
force-ffmpeg,force-opencollada,\
skip-python,skip-numpy,skip-boost,skip-ocio,skip-openexr,skip-oiio,skip-llvm,skip-osl,skip-osd,\
skip-ffmpeg,skip-opencollada,\
force-all,force-python,force-numpy,force-boost,force-ocio,force-oiio,force-llvm,force-osl,force-opencollada,\
force-ffmpeg,\
skip-python,skip-numpy,skip-boost,skip-ocio,skip-openexr,skip-oiio,skip-llvm,skip-osl,skip-ffmpeg,skip-opencollada,\
required-numpy: \
-- "$@" \
)
@@ -139,9 +138,6 @@ ARGUMENTS_INFO="\"COMMAND LINE ARGUMENTS:
--force-osl
Force the rebuild of OpenShadingLanguage.
--force-osd
Force the rebuild of OpenSubdiv.
--force-opencollada
Force the rebuild of OpenCOLLADA.
@@ -178,9 +174,6 @@ ARGUMENTS_INFO="\"COMMAND LINE ARGUMENTS:
--skip-osl
Unconditionally skip OpenShadingLanguage installation/building.
--skip-osd
Unconditionally skip OpenSubdiv installation/building.
--skip-opencollada
Unconditionally skip OpenCOLLADA installation/building.
@@ -240,12 +233,6 @@ OSL_VERSION_MIN=$OSL_VERSION
OSL_FORCE_REBUILD=false
OSL_SKIP=false
# OpenSubdiv needs to be compiled for now
OSD_VERSION="3.0.2"
OSD_VERSION_MIN=$OSD_VERSION
OSD_FORCE_REBUILD=false
OSD_SKIP=false
# Version??
OPENCOLLADA_VERSION="1.3"
OPENCOLLADA_FORCE_REBUILD=false
@@ -388,11 +375,6 @@ while true; do
OSL_VERSION_MIN=$OSL_VERSION
shift; shift; continue
;;
--ver-osd)
OSD_VERSION="$2"
OSD_VERSION_MIN=$OSD_VERSION
shift; shift; continue
;;
--force-all)
PYTHON_FORCE_REBUILD=true
NUMPY_FORCE_REBUILD=true
@@ -402,7 +384,6 @@ while true; do
OIIO_FORCE_REBUILD=true
LLVM_FORCE_REBUILD=true
OSL_FORCE_REBUILD=true
OSD_FORCE_REBUILD=true
OPENCOLLADA_FORCE_REBUILD=true
FFMPEG_FORCE_REBUILD=true
shift; continue
@@ -436,9 +417,6 @@ while true; do
--force-osl)
OSL_FORCE_REBUILD=true; shift; continue
;;
--force-osd)
OSD_FORCE_REBUILD=true; shift; continue
;;
--force-opencollada)
OPENCOLLADA_FORCE_REBUILD=true; shift; continue
;;
@@ -469,9 +447,6 @@ while true; do
--skip-osl)
OSL_SKIP=true; shift; continue
;;
--skip-osd)
OSD_SKIP=true; shift; continue
;;
--skip-opencollada)
OPENCOLLADA_SKIP=true; shift; continue
;;
@@ -534,14 +509,6 @@ OSL_SOURCE_REPO=( "https://github.com/Nazg-Gul/OpenShadingLanguage.git" )
OSL_SOURCE_REPO_UID="22ee5ea298fd215430dfbd160b5aefd507f06db0"
OSL_SOURCE_REPO_BRANCH="blender-fixes"
OSD_USE_REPO=true
# Script foo to make the version string compliant with the archive name:
# ${Varname//SearchForThisChar/ReplaceWithThisChar}
OSD_SOURCE=( "https://github.com/PixarAnimationStudios/OpenSubdiv/archive/v${OSD_VERSION//./_}.tar.gz" )
OSD_SOURCE_REPO=( "https://github.com/PixarAnimationStudios/OpenSubdiv.git" )
OSD_SOURCE_REPO_UID="404659fffa659da075d1c9416e4fc939139a84ee"
OSD_SOURCE_REPO_BRANCH="dev"
OPENCOLLADA_SOURCE=( "https://github.com/KhronosGroup/OpenCOLLADA.git" )
OPENCOLLADA_REPO_UID="3335ac164e68b2512a40914b14c74db260e6ff7d"
FFMPEG_SOURCE=( "http://ffmpeg.org/releases/ffmpeg-$FFMPEG_VERSION.tar.bz2" )
@@ -1555,99 +1522,6 @@ compile_OSL() {
run_ldconfig "osl"
}
#### Build OSD ####
_init_osd() {
_src=$SRC/OpenSubdiv-$OSD_VERSION
_git=true
_inst=$INST/osd-$OSD_VERSION
_inst_shortcut=$INST/osd
}
clean_OSD() {
_init_osd
_clean
}
compile_OSD() {
# To be changed each time we make edits that would modify the compiled result!
osd_magic=0
_init_osd
# Clean install if needed!
magic_compile_check osd-$OSD_VERSION $osd_magic
if [ $? -eq 1 -o $OSD_FORCE_REBUILD == true ]; then
clean_OSD
fi
if [ ! -d $_inst ]; then
INFO "Building OpenSubdiv-$OSD_VERSION"
prepare_opt
if [ ! -d $_src ]; then
mkdir -p $SRC
if [ $OSD_USE_REPO == true ]; then
git clone ${OSD_SOURCE_REPO[0]} $_src
else
download OSD_SOURCE[@] "$_src.tar.gz"
INFO "Unpacking OpenSubdiv-$OSD_VERSION"
tar -C $SRC --transform "s,(.*/?)OpenSubdiv-[^/]*(.*),\1OpenSubdiv-$OSD_VERSION\2,x" \
-xf $_src.tar.gz
fi
fi
cd $_src
if [ $OSD_USE_REPO == true ]; then
git remote set-url origin ${OSD_SOURCE_REPO[0]}
# XXX For now, always update from latest repo...
git pull --no-edit -X theirs origin $OSD_SOURCE_REPO_BRANCH
# Stick to same rev as windows' libs...
git checkout $OSD_SOURCE_REPO_UID
git reset --hard
fi
# Always refresh the whole build!
if [ -d build ]; then
rm -rf build
fi
mkdir build
cd build
cmake_d="-D CMAKE_BUILD_TYPE=Release"
cmake_d="$cmake_d -D CMAKE_INSTALL_PREFIX=$_inst"
# ptex is only needed when nicholas bishop is ready
cmake_d="$cmake_d -D NO_PTEX=1"
cmake_d="$cmake_d -D NO_CLEW=1"
# maya plugin, docs, tutorials, regression tests and examples are not needed
cmake_d="$cmake_d -D NO_MAYA=1 -D NO_DOC=1 -D NO_TUTORIALS=1 -D NO_REGRESSION=1 -DNO_EXAMPLES=1"
cmake $cmake_d ..
make -j$THREADS && make install
make clean
if [ -d $_inst ]; then
_create_inst_shortcut
else
ERROR "OpenSubdiv-$OSD_VERSION failed to compile, exiting"
exit 1
fi
magic_compile_set osd-$OSD_VERSION $osd_magic
cd $CWD
INFO "Done compiling OpenSubdiv-$OSD_VERSION!"
else
INFO "Own OpenSubdiv-$OSD_VERSION is up to date, nothing to do!"
INFO "If you want to force rebuild of this lib, use the --force-osd option."
fi
run_ldconfig "osd"
}
#### Build OpenCOLLADA ####
_init_opencollada() {
_src=$SRC/OpenCOLLADA-$OPENCOLLADA_VERSION
@@ -1939,9 +1813,8 @@ install_DEB() {
THEORA_DEV="libtheora-dev"
_packages="gawk cmake cmake-curses-gui scons build-essential libjpeg-dev libpng-dev \
libfreetype6-dev libx11-dev \
libxcursor-dev libxi-dev wget libsqlite3-dev libxrandr-dev libxinerama-dev \
libbz2-dev libncurses5-dev libssl-dev liblzma-dev libreadline-dev $OPENJPEG_DEV \
libfreetype6-dev libx11-dev libxi-dev wget libsqlite3-dev libbz2-dev \
libncurses5-dev libssl-dev liblzma-dev libreadline-dev $OPENJPEG_DEV \
libopenal-dev libglew-dev libglewmx-dev yasm $THEORA_DEV $VORBIS_DEV $OGG_DEV \
libsdl1.2-dev libfftw3-dev patch bzip2 libxml2-dev libtinyxml-dev"
@@ -2216,20 +2089,6 @@ install_DEB() {
fi
fi
PRINT ""
if $OSD_SKIP; then
WARNING "Skipping OpenSubdiv installation, as requested..."
else
if $have_llvm; then
install_packages_DEB flex bison libtbb-dev
# No package currently!
PRINT ""
compile_OSD
else
WARNING "No LLVM available, cannot build OSD!"
fi
fi
if $WITH_OPENCOLLADA; then
PRINT ""
if $OPENCOLLADA_SKIP; then
@@ -2428,9 +2287,9 @@ install_RPM() {
OGG_DEV="libogg-devel"
THEORA_DEV="libtheora-devel"
_packages="gcc gcc-c++ git make cmake scons libtiff-devel libjpeg-devel\
libpng-devel libX11-devel libXi-devel libXcursor-devel libXrandr-devel libXinerama-devel \
wget ncurses-devel readline-devel $OPENJPEG_DEV openal-soft-devel \
_packages="gcc gcc-c++ make scons libtiff-devel libjpeg-devel\
libpng-devel libX11-devel libXi-devel wget ncurses-devel \
readline-devel $OPENJPEG_DEV openal-soft-devel \
glew-devel yasm $THEORA_DEV $VORBIS_DEV $OGG_DEV patch \
libxml2-devel yaml-cpp-devel tinyxml-devel"
@@ -2657,7 +2516,7 @@ install_RPM() {
else
if $have_llvm; then
# No package currently!
install_packages_RPM flex bison
install_packages_RPM flex bison git
if [ $RPM = "FEDORA" -o $RPM = "RHEL" ]; then
install_packages_RPM tbb-devel
fi
@@ -2668,29 +2527,12 @@ install_RPM() {
fi
fi
PRINT ""
if $OSD_SKIP; then
WARNING "Skipping OpenSubdiv installation, as requested..."
else
if $have_llvm; then
# No package currently!
install_packages_RPM flex bison
if [ $RPM = "FEDORA" -o $RPM = "RHEL" ]; then
install_packages_RPM tbb-devel
fi
PRINT ""
compile_OSD
else
WARNING "No LLVM available, cannot build OSD!"
fi
fi
if $WITH_OPENCOLLADA; then
PRINT ""
if $OPENCOLLADA_SKIP; then
WARNING "Skipping OpenCOLLADA installation, as requested..."
else
install_packages_RPM pcre-devel
install_packages_RPM pcre-devel git
# Find path to libxml shared lib...
_XML2_LIB=`rpm -ql libxml2-devel | grep -e ".*/libxml2.so"`
# No package...
@@ -2798,8 +2640,7 @@ install_ARCH() {
OGG_DEV="libogg"
THEORA_DEV="libtheora"
_packages="base-devel git scons cmake \
libxi libxcursor libxrandr libxinerama glew libpng libtiff wget openal \
_packages="base-devel scons cmake libxi glew libpng libtiff wget openal \
$OPENJPEG_DEV $VORBIS_DEV $OGG_DEV $THEORA_DEV yasm sdl fftw \
libxml2 yaml-cpp tinyxml"
@@ -2986,7 +2827,7 @@ install_ARCH() {
clean_OSL
else
#XXX Note: will fail to build with LLVM 3.2!
install_packages_ARCH intel-tbb
install_packages_ARCH git intel-tbb
PRINT ""
compile_OSL
fi
@@ -2995,20 +2836,6 @@ install_ARCH() {
fi
fi
PRINT ""
if $OSD_SKIP; then
WARNING "Skipping OpenSubdiv installation, as requested..."
else
if $have_llvm; then
# No package currently? Just build for now!
install_packages_ARCH intel-tbb
PRINT ""
compile_OSD
else
WARNING "No LLVM available, cannot build OSD!"
fi
fi
if $WITH_OPENCOLLADA; then
PRINT ""
if $OPENCOLLADA_SKIP; then
@@ -3019,7 +2846,7 @@ install_ARCH() {
install_packages_ARCH opencollada
clean_OpenCOLLADA
else
install_packages_ARCH pcre
install_packages_ARCH pcre git
PRINT ""
compile_OpenCOLLADA
fi
@@ -3184,14 +3011,6 @@ print_info() {
_buildargs="$_buildargs $_1 $_2"
fi
if [ -d $INST/osd ]; then
_1="-D WITH_OPENSUBDIV=ON"
_2="-D OPENSUBDIV_ROOT_DIR=$INST/osd"
PRINT " $_1"
PRINT " $_2"
_buildargs="$_buildargs $_1 $_2"
fi
if $WITH_OPENCOLLADA; then
_1="-D WITH_OPENCOLLADA=ON"
PRINT " $_1"
@@ -3258,13 +3077,6 @@ print_info() {
PRINT "BF_OSL = '$INST/osl'"
fi
if [ "$OSD_SKIP" = false ]; then
PRINT "WITH_BF_OPENSUBDIV = True"
if [ -d $INST/osd ]; then
PRINT "BF_OPENSUBDIV = '$INST/osd'"
fi
fi
if [ "$BOOST_SKIP" = false ]; then
PRINT "WITH_BF_BOOST = True"
if [ -d $INST/boost ]; then
@@ -3311,27 +3123,7 @@ elif [ -f /etc/redhat-release -o /etc/SuSE-release ]; then
DISTRO="RPM"
install_RPM
else
ERROR "Failed to detect distribution type."
PRINT ""
PRINT "Your distribution is not supported by this script, you'll have to install dependencies and"
PRINT "dev packages yourself (list non-exhaustive, but should cover most needs):"
PRINT " * Basics of dev environment (cmake or scons, gcc, svn , git, ...)."
PRINT " * Python$PYTHON_VERSION_MIN, numpy."
PRINT " * libboost$BOOST_VERSION_MIN (locale, filesystem, regex, system, thread, wave)."
PRINT " * libjpeg, libpng, libtiff, libopenjpeg, libopenal."
PRINT " * ffmpeg (with libvorbis, libogg, libtheora, libx264, libmp3lame, libxvidcore, libvpx, ...)."
PRINT " * libx11, libxcursor, libxi, libxrandr, libxinerama (and other libx... as needed)."
PRINT " * libsqlite3, libbz2, libssl, libfftw3, libxml2, libtinyxml, yasm, libyaml-cpp."
PRINT " * libsdl1.2, libglew, libglewmx."
PRINT " * libopencolorio$OCIO_VERSION_MIN, libopenexr$OPENEXR_VERSION_MIN, libopenimageio$OIIO_VERSION_MIN."
PRINT " * llvm-$LLVM_VERSION (with clang)."
PRINT ""
PRINT "Most of up-listed packages are available in recent distributions. The following are likely not,"
PRINT "you'll have to build them (they are all optional, though):"
PRINT " * OpenShadingLanguage (from https://github.com/Nazg-Gul/OpenShadingLanguage.git, branch blender-fixes, commit 22ee5ea298fd215430dfbd160b5aefd507f06db0)."
PRINT " * OpenSubDiv (from https://github.com/PixarAnimationStudios/OpenSubdiv.git, branch dev, commit 404659fffa659da075d1c9416e4fc939139a84ee)."
PRINT " * OpenCollada (from https://github.com/KhronosGroup/OpenCOLLADA.git, branch master, commit 3335ac164e68b2512a40914b14c74db260e6ff7d)."
PRINT ""
ERROR "Failed to detect distribution type"
exit 1
fi

View File

@@ -2,5 +2,4 @@ BF_BUILDDIR = '../blender-build/linux-glibc211-i686'
BF_INSTALLDIR = '../blender-install/linux-glibc211-i686'
BF_NUMJOBS = 1
#BF_CYCLES_CUDA_BINARIES_ARCH = ['sm_20', 'sm_21', 'sm_30', 'sm_35', 'sm_50', 'sm_52']
BF_CYCLES_CUDA_BINARIES_ARCH = []
BF_CYCLES_CUDA_BINARIES_ARCH = ['sm_20', 'sm_21', 'sm_30', 'sm_35', 'sm_50', 'sm_52']

View File

@@ -166,15 +166,6 @@ BF_BOOST_LIBPATH = '${BF_BOOST}/lib'
# Ocean Simulation
WITH_BF_OCEANSIM = True
# OpenSubdiv
WITH_BF_OPENSUBDIV = True
WITH_BF_STATICOPENSUBDIV = True
BF_OPENSUBDIV = '/opt/lib/opensubdiv'
BF_OPENSUBDIV_INC = '${BF_OPENSUBDIV}/include'
BF_OPENSUBDIV_LIB = 'osdCPU osdGPU'
BF_OPENSUBDIV_LIBPATH = '${BF_OPENSUBDIV}/lib'
BF_OPENSUBDIV_LIB_STATIC = '${BF_OPENSUBDIV}/lib/libosdCPU.a ${BF_OPENSUBDIV}/lib/libosdGPU.a'
# Compilation and optimization
BF_DEBUG = False
REL_CCFLAGS = ['-DNDEBUG', '-O2', '-msse', '-msse2'] # C & C++

View File

@@ -166,15 +166,6 @@ BF_BOOST_LIBPATH = '${BF_BOOST}/lib'
# Ocean Simulation
WITH_BF_OCEANSIM = True
# OpenSubdiv
WITH_BF_OPENSUBDIV = True
WITH_BF_STATICOPENSUBDIV = True
BF_OPENSUBDIV = '/opt/lib/opensubdiv'
BF_OPENSUBDIV_INC = '${BF_OPENSUBDIV}/include'
BF_OPENSUBDIV_LIB = 'osdCPU osdGPU'
BF_OPENSUBDIV_LIBPATH = '${BF_OPENSUBDIV}/lib'
BF_OPENSUBDIV_LIB_STATIC = '${BF_OPENSUBDIV}/lib/libosdCPU.a ${BF_OPENSUBDIV}/lib/libosdGPU.a'
# Compilation and optimization
BF_DEBUG = False
REL_CCFLAGS = ['-DNDEBUG', '-O2', '-msse', '-msse2'] # C & C++

View File

@@ -4,7 +4,7 @@
# <pep8 compliant>
# List of the branches being built automatically overnight
NIGHT_SCHEDULE_BRANCHES = [None]
NIGHT_SCHEDULE_BRANCHES = [None, "gooseberry"]
# List of the branches available for force build
FORCE_SCHEDULE_BRANCHES = ["master", "gooseberry", "experimental-build"]
@@ -305,12 +305,12 @@ add_builder(c, 'mac_x86_64_10_6_scons', 'darwin-9.x.universal', generic_builder,
add_builder(c, 'mac_i386_10_6_scons', 'darwin-9.x.universal', generic_builder, hour=11)
add_builder(c, 'linux_glibc211_i386_scons', '', generic_builder, hour=1)
add_builder(c, 'linux_glibc211_x86_64_scons', '', generic_builder, hour=2)
#add_builder(c, 'win32_scons_vc2013', 'windows_vc12', generic_builder, hour=1)
#add_builder(c, 'win64_scons_vc2013', 'win64_vc12', generic_builder, hour=2)
add_builder(c, 'win32_scons_vc2013', 'windows_vc12', generic_builder, hour=1)
add_builder(c, 'win64_scons_vc2013', 'win64_vc12', generic_builder, hour=2)
add_builder(c, 'win32_cmake_vc2013', 'windows_vc12', generic_builder, hour=3)
add_builder(c, 'win64_cmake_vc2013', 'win64_vc12', generic_builder, hour=4)
#add_builder(c, 'mingw_win32_scons', 'mingw32', generic_builder, hour=4)
#add_builder(c, 'mingw_win64_scons', 'mingw64', generic_builder, hour=3)
add_builder(c, 'mingw_win64_scons', 'mingw64', generic_builder, hour=3)
#add_builder(c, 'freebsd_i386_cmake', '', generic_builder, hour=1)
#add_builder(c, 'freebsd_x86_64_cmake', '', generic_builder, hour=2)

View File

@@ -57,10 +57,7 @@ if 'cmake' in builder:
retcode = subprocess.call(['cmake', blender_dir] + cmake_options)
if retcode != 0:
sys.exit(retcode)
if 'win32' in builder:
retcode = subprocess.call(['msbuild', 'INSTALL.vcxproj', '/Property:PlatformToolset=v120_xp', '/p:Configuration=Release'])
elif 'win64' in builder:
if 'win' in builder:
retcode = subprocess.call(['msbuild', 'INSTALL.vcxproj', '/p:Configuration=Release'])
else:
retcode = subprocess.call(['make', '-s', '-j4', 'install'])

View File

@@ -123,26 +123,14 @@ else:
os.remove(f)
retcode = subprocess.call(['cpack', '-G', 'ZIP'])
result_file = [f for f in os.listdir('.') if os.path.isfile(f) and f.endswith('.zip')][0]
# TODO(sergey): Such magic usually happens in SCon's packaging bu we don't have it
# in the CMake yet. For until then we do some magic here.
tokens = result_file.split('-')
blender_version = tokens[1].split('.')
blender_full_version = '.'.join(blender_version[0:2])
git_hash = tokens[2].split('.')[1]
platform = builder.split('_')[0]
builderified_name = 'blender-{}-{}-{}'.format(blender_full_version, git_hash, platform)
if branch != '':
builderified_name = branch + "-" + builderified_name
os.rename(result_file, "{}.zip".format(builderified_name))
os.rename(result_file, "{}.zip".format(builder))
# create zip file
try:
upload_zip = "buildbot_upload.zip"
if os.path.exists(upload_zip):
os.remove(upload_zip)
z = zipfile.ZipFile(upload_zip, "w", compression=zipfile.ZIP_STORED)
z.write("{}.zip".format(builderified_name))
z.write("{}.zip".format(builder))
z.close()
sys.exit(retcode)
except Exception as ex:

View File

@@ -1,113 +0,0 @@
# - Try to find audaspace
# Once done, this will define
#
# AUDASPACE_FOUND - system has audaspace
# AUDASPACE_INCLUDE_DIRS - the audaspace include directories
# AUDASPACE_LIBRARIES - link these to use audaspace
# AUDASPACE_C_FOUND - system has audaspace's C binding
# AUDASPACE_C_INCLUDE_DIRS - the audaspace's C binding include directories
# AUDASPACE_C_LIBRARIES - link these to use audaspace's C binding
# AUDASPACE_PY_FOUND - system has audaspace's python binding
# AUDASPACE_PY_INCLUDE_DIRS - the audaspace's python binding include directories
# AUDASPACE_PY_LIBRARIES - link these to use audaspace's python binding
IF(NOT AUDASPACE_ROOT_DIR AND NOT $ENV{AUDASPACE_ROOT_DIR} STREQUAL "")
SET(AUDASPACE_ROOT_DIR $ENV{AUDASPACE_ROOT_DIR})
ENDIF()
SET(_audaspace_SEARCH_DIRS
${AUDASPACE_ROOT_DIR}
/usr/local
/sw # Fink
/opt/local # DarwinPorts
/opt/csw # Blastwave
)
# Use pkg-config to get hints about paths
FIND_PACKAGE(PkgConfig)
IF(PKG_CONFIG_FOUND)
PKG_CHECK_MODULES(AUDASPACE_PKGCONF audaspace)
ENDIF(PKG_CONFIG_FOUND)
# Include dir
FIND_PATH(AUDASPACE_INCLUDE_DIR
NAMES ISound.h
HINTS ${_audaspace_SEARCH_DIRS}
PATHS ${AUDASPACE_PKGCONF_INCLUDE_DIRS}
PATH_SUFFIXES include/audaspace
)
# Library
FIND_LIBRARY(AUDASPACE_LIBRARY
NAMES audaspace
HINTS ${_audaspace_SEARCH_DIRS}
PATHS ${AUDASPACE_PKGCONF_LIBRARY_DIRS}
PATH_SUFFIXES lib lib64
)
# Include dir
FIND_PATH(AUDASPACE_C_INCLUDE_DIR
NAMES AUD_Sound.h
HINTS ${_audaspace_SEARCH_DIRS}
PATHS ${AUDASPACE_PKGCONF_INCLUDE_DIRS}
PATH_SUFFIXES include/audaspace
)
# Library
FIND_LIBRARY(AUDASPACE_C_LIBRARY
NAMES audaspace-c
HINTS ${_audaspace_SEARCH_DIRS}
PATHS ${AUDASPACE_PKGCONF_LIBRARY_DIRS}
PATH_SUFFIXES lib lib64
)
# Include dir
FIND_PATH(AUDASPACE_PY_INCLUDE_DIR
NAMES python/PyAPI.h
HINTS ${_audaspace_SEARCH_DIRS}
PATHS ${AUDASPACE_PKGCONF_INCLUDE_DIRS}
PATH_SUFFIXES include/audaspace
)
# Library
FIND_LIBRARY(AUDASPACE_PY_LIBRARY
NAMES audaspace-py
HINTS ${_audaspace_SEARCH_DIRS}
PATHS ${AUDASPACE_PKGCONF_LIBRARY_DIRS}
PATH_SUFFIXES lib lib64
)
FIND_PACKAGE(PackageHandleStandardArgs)
FIND_PACKAGE_HANDLE_STANDARD_ARGS(Audaspace DEFAULT_MSG AUDASPACE_LIBRARY AUDASPACE_INCLUDE_DIR)
FIND_PACKAGE_HANDLE_STANDARD_ARGS(Audaspace_C DEFAULT_MSG AUDASPACE_C_LIBRARY AUDASPACE_C_INCLUDE_DIR)
FIND_PACKAGE_HANDLE_STANDARD_ARGS(Audaspace_Py DEFAULT_MSG AUDASPACE_PY_LIBRARY AUDASPACE_PY_INCLUDE_DIR)
IF(AUDASPACE_FOUND)
SET(AUDASPACE_LIBRARIES ${AUDASPACE_LIBRARY})
SET(AUDASPACE_INCLUDE_DIRS ${AUDASPACE_INCLUDE_DIR})
ENDIF(AUDASPACE_FOUND)
IF(AUDASPACE_C_FOUND)
SET(AUDASPACE_C_LIBRARIES ${AUDASPACE_C_LIBRARY})
SET(AUDASPACE_C_INCLUDE_DIRS ${AUDASPACE_C_INCLUDE_DIR})
ENDIF(AUDASPACE_C_FOUND)
IF(AUDASPACE_PY_FOUND)
SET(AUDASPACE_PY_LIBRARIES ${AUDASPACE_PY_LIBRARY})
SET(AUDASPACE_PY_INCLUDE_DIRS ${AUDASPACE_PY_INCLUDE_DIR})
ENDIF(AUDASPACE_PY_FOUND)
MARK_AS_ADVANCED(
AUDASPACE_LIBRARY
AUDASPACE_LIBRARIES
AUDASPACE_INCLUDE_DIR
AUDASPACE_INCLUDE_DIRS
AUDASPACE_C_LIBRARY
AUDASPACE_C_LIBRARIES
AUDASPACE_C_INCLUDE_DIR
AUDASPACE_C_INCLUDE_DIRS
AUDASPACE_PY_LIBRARY
AUDASPACE_PY_LIBRARIES
AUDASPACE_PY_INCLUDE_DIR
AUDASPACE_PY_INCLUDE_DIRS
)

View File

@@ -1,111 +0,0 @@
# - Find OpenSubdiv library
# Find the native OpenSubdiv includes and library
# This module defines
# OPENSUBDIV_INCLUDE_DIRS, where to find OpenSubdiv headers, Set when
# OPENSUBDIV_INCLUDE_DIR is found.
# OPENSUBDIV_LIBRARIES, libraries to link against to use OpenSubdiv.
# OPENSUBDIV_ROOT_DIR, the base directory to search for OpenSubdiv.
# This can also be an environment variable.
# OPENSUBDIV_FOUND, if false, do not try to use OpenSubdiv.
#
# also defined, but not for general use are
# OPENSUBDIV_LIBRARY, where to find the OpenSubdiv library.
#=============================================================================
# Copyright 2013 Blender Foundation.
#
# Distributed under the OSI-approved BSD License (the "License");
# see accompanying file Copyright.txt for details.
#
# This software is distributed WITHOUT ANY WARRANTY; without even the
# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
# See the License for more information.
#=============================================================================
# If OPENSUBDIV_ROOT_DIR was defined in the environment, use it.
IF(NOT OPENSUBDIV_ROOT_DIR AND NOT $ENV{OPENSUBDIV_ROOT_DIR} STREQUAL "")
SET(OPENSUBDIV_ROOT_DIR $ENV{OPENSUBDIV_ROOT_DIR})
ENDIF()
SET(_opensubdiv_FIND_COMPONENTS
osdGPU
osdCPU
)
SET(_opensubdiv_SEARCH_DIRS
${OPENSUBDIV_ROOT_DIR}
/usr/local
/sw # Fink
/opt/local # DarwinPorts
/opt/csw # Blastwave
/opt/lib/opensubdiv
)
FIND_PATH(OPENSUBDIV_INCLUDE_DIR
NAMES
opensubdiv/osd/mesh.h
HINTS
${_opensubdiv_SEARCH_DIRS}
PATH_SUFFIXES
include
)
SET(_opensubdiv_LIBRARIES)
FOREACH(COMPONENT ${_opensubdiv_FIND_COMPONENTS})
STRING(TOUPPER ${COMPONENT} UPPERCOMPONENT)
FIND_LIBRARY(OPENSUBDIV_${UPPERCOMPONENT}_LIBRARY
NAMES
${COMPONENT}
HINTS
${_opensubdiv_SEARCH_DIRS}
PATH_SUFFIXES
lib64 lib
)
LIST(APPEND _opensubdiv_LIBRARIES "${OPENSUBDIV_${UPPERCOMPONENT}_LIBRARY}")
ENDFOREACH()
MACRO(OPENSUBDIV_CHECK_CONTROLLER
controller_include_file
variable_name)
IF(EXISTS "${OPENSUBDIV_INCLUDE_DIR}/opensubdiv/osd/${controller_include_file}")
SET(${variable_name} TRUE)
ELSE()
SET(${variable_name} FALSE)
ENDIF()
ENDMACRO()
# handle the QUIETLY and REQUIRED arguments and set OPENSUBDIV_FOUND to TRUE if
# all listed variables are TRUE
INCLUDE(FindPackageHandleStandardArgs)
FIND_PACKAGE_HANDLE_STANDARD_ARGS(OpenSubdiv DEFAULT_MSG
_opensubdiv_LIBRARIES OPENSUBDIV_INCLUDE_DIR)
IF(OPENSUBDIV_FOUND)
SET(OPENSUBDIV_LIBRARIES ${_opensubdiv_LIBRARIES})
SET(OPENSUBDIV_INCLUDE_DIRS ${OPENSUBDIV_INCLUDE_DIR})
# Find available compute controllers.
FIND_PACKAGE(OpenMP)
IF(OPENMP_FOUND)
SET(OPENSUBDIV_HAS_OPENMP TRUE)
ELSE()
SET(OPENSUBDIV_HAS_OPENMP FALSE)
ENDIF()
OPENSUBDIV_CHECK_CONTROLLER("tbbEvaluator.h" OPENSUBDIV_HAS_TBB)
OPENSUBDIV_CHECK_CONTROLLER("clEvaluator.h" OPENSUBDIV_HAS_OPENCL)
OPENSUBDIV_CHECK_CONTROLLER("cudaEvaluator.h" OPENSUBDIV_HAS_CUDA)
OPENSUBDIV_CHECK_CONTROLLER("glXFBEvaluator.h" OPENSUBDIV_HAS_GLSL_TRANSFORM_FEEDBACK)
OPENSUBDIV_CHECK_CONTROLLER("glComputeEvaluator.h" OPENSUBDIV_HAS_GLSL_COMPUTE)
ENDIF(OPENSUBDIV_FOUND)
MARK_AS_ADVANCED(
OPENSUBDIV_INCLUDE_DIR
)
FOREACH(COMPONENT ${_opensubdiv_FIND_COMPONENTS})
STRING(TOUPPER ${COMPONENT} UPPERCOMPONENT)
MARK_AS_ADVANCED(OPENSUBDIV_${UPPERCOMPONENT}_LIBRARY)
ENDFOREACH()

View File

@@ -12,7 +12,7 @@
#
#=============================================================================
macro(BLENDER_SRC_GTEST_EX NAME SRC EXTRA_LIBS DO_ADD_TEST)
macro(BLENDER_SRC_GTEST NAME SRC EXTRA_LIBS)
if(WITH_GTESTS)
get_property(_current_include_directories
DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
@@ -40,20 +40,10 @@ macro(BLENDER_SRC_GTEST_EX NAME SRC EXTRA_LIBS DO_ADD_TEST)
RUNTIME_OUTPUT_DIRECTORY_RELEASE "${TESTS_OUTPUT_DIR}"
RUNTIME_OUTPUT_DIRECTORY_DEBUG "${TESTS_OUTPUT_DIR}"
INCLUDE_DIRECTORIES "${TEST_INC}")
if(${DO_ADD_TEST})
add_test(${NAME}_test ${TESTS_OUTPUT_DIR}/${NAME}_test)
endif()
add_test(${NAME}_test ${TESTS_OUTPUT_DIR}/${NAME}_test)
endif()
endmacro()
macro(BLENDER_SRC_GTEST NAME SRC EXTRA_LIBS)
BLENDER_SRC_GTEST_EX("${NAME}" "${SRC}" "${EXTRA_LIBS}" "TRUE")
endmacro()
macro(BLENDER_TEST NAME EXTRA_LIBS)
BLENDER_SRC_GTEST_EX("${NAME}" "${NAME}_test.cc" "${EXTRA_LIBS}" "TRUE")
endmacro()
macro(BLENDER_TEST_PERFORMANCE NAME EXTRA_LIBS)
BLENDER_SRC_GTEST_EX("${NAME}" "${NAME}_test.cc" "${EXTRA_LIBS}" "FALSE")
BLENDER_SRC_GTEST("${NAME}" "${NAME}_test.cc" "${EXTRA_LIBS}")
endmacro()

View File

@@ -97,10 +97,6 @@ if(EXISTS ${SOURCE_DIR}/.git)
WORKING_DIRECTORY ${SOURCE_DIR}
OUTPUT_VARIABLE MY_WC_COMMIT_TIMESTAMP
OUTPUT_STRIP_TRAILING_WHITESPACE)
# May fail in rare cases
if(MY_WC_COMMIT_TIMESTAMP STREQUAL "")
set(MY_WC_COMMIT_TIMESTAMP 0)
endif()
# Update GIT index before getting dirty files
execute_process(COMMAND git update-index -q --refresh

View File

@@ -1,4 +1,5 @@
# Turn everything ON thats expected for an official release builds.
# turn everything OFF except for python which defaults to ON
# and is needed for the UI
#
# Example usage:
# cmake -C../blender/build_files/cmake/config/blender_full.cmake ../blender
@@ -12,7 +13,6 @@ set(WITH_CODEC_SNDFILE ON CACHE BOOL "" FORCE)
set(WITH_CYCLES ON CACHE BOOL "" FORCE)
set(WITH_FFTW3 ON CACHE BOOL "" FORCE)
set(WITH_LIBMV ON CACHE BOOL "" FORCE)
set(WITH_LIBMV_SCHUR_SPECIALIZATIONS ON CACHE BOOL "" FORCE)
set(WITH_GAMEENGINE ON CACHE BOOL "" FORCE)
set(WITH_COMPOSITOR ON CACHE BOOL "" FORCE)
set(WITH_FREESTYLE ON CACHE BOOL "" FORCE)
@@ -52,18 +52,11 @@ set(WITH_X11_XF86VMODE ON CACHE BOOL "" FORCE)
set(WITH_PLAYER ON CACHE BOOL "" FORCE)
set(WITH_MEM_JEMALLOC ON CACHE BOOL "" FORCE)
# platform dependant options
if(UNIX AND NOT APPLE)
set(WITH_JACK ON CACHE BOOL "" FORCE)
set(WITH_DOC_MANPAGE ON CACHE BOOL "" FORCE)
set(WITH_OPENSUBDIV ON CACHE BOOL "" FORCE)
elseif(WIN32)
set(WITH_JACK OFF CACHE BOOL "" FORCE)
set(WITH_OPENSUBDIV ON CACHE BOOL "" FORCE)
elseif (APPLE)
set(WITH_JACK ON CACHE BOOL "" FORCE)
set(WITH_CODEC_QUICKTIME ON CACHE BOOL "" FORCE)
set(WITH_OPENSUBDIV OFF CACHE BOOL "" FORCE)
endif()
if(APPLE)
set(WITH_CODEC_QUICKTIME ON CACHE BOOL "" FORCE)
endif()

View File

@@ -48,7 +48,7 @@ macro(list_insert_before
unset(_index)
endmacro()
function(list_assert_duplicates
function (list_assert_duplicates
list_id
)
@@ -343,9 +343,6 @@ function(setup_liblinks
if(WITH_BULLET AND WITH_SYSTEM_BULLET)
target_link_libraries(${target} ${BULLET_LIBRARIES})
endif()
if(WITH_AUDASPACE AND WITH_SYSTEM_AUDASPACE)
target_link_libraries(${target} ${AUDASPACE_C_LIBRARIES} ${AUDASPACE_PY_LIBRARIES})
endif()
if(WITH_OPENAL)
target_link_libraries(${target} ${OPENAL_LIBRARY})
endif()
@@ -373,16 +370,6 @@ function(setup_liblinks
if(WITH_OPENCOLORIO)
target_link_libraries(${target} ${OPENCOLORIO_LIBRARIES})
endif()
if(WITH_OPENSUBDIV)
if(WIN32 AND NOT UNIX)
file_list_suffix(OPENSUBDIV_LIBRARIES_DEBUG "${OPENSUBDIV_LIBRARIES}" "_d")
target_link_libraries_debug(${target} "${OPENSUBDIV_LIBRARIES_DEBUG}")
target_link_libraries_optimized(${target} "${OPENSUBDIV_LIBRARIES}")
unset(OPENSUBDIV_LIBRARIES_DEBUG)
else()
target_link_libraries(${target} ${OPENSUBDIV_LIBRARIES})
endif()
endif()
if(WITH_CYCLES_OSL)
target_link_libraries(${target} ${OSL_LIBRARIES})
endif()
@@ -608,7 +595,6 @@ function(SETUP_BLENDER_SORTED_LIBS)
extern_libmv
extern_glog
extern_sdlew
extern_eigen3
bf_intern_glew_mx
)
@@ -687,10 +673,6 @@ function(SETUP_BLENDER_SORTED_LIBS)
list_insert_after(BLENDER_SORTED_LIBS "ge_logic_ngnetwork" "extern_bullet")
endif()
if(WITH_OPENSUBDIV)
list(APPEND BLENDER_SORTED_LIBS bf_intern_opensubdiv)
endif()
foreach(SORTLIB ${BLENDER_SORTED_LIBS})
set(REMLIB ${SORTLIB})
foreach(SEARCHLIB ${BLENDER_LINK_LIBS})

View File

@@ -24,7 +24,7 @@ if(EXISTS ${CMAKE_SOURCE_DIR}/.git/)
include(FindGit)
if(GIT_FOUND)
message(STATUS "-- Found Git: ${GIT_EXECUTABLE}")
execute_process(COMMAND git rev-parse --short HEAD
execute_process(COMMAND git rev-parse --short @{u}
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
OUTPUT_VARIABLE MY_WC_HASH
OUTPUT_STRIP_TRAILING_WHITESPACE

View File

@@ -59,21 +59,14 @@ def is_c_any(filename):
CMAKE_DIR = "."
def cmake_cache_var_iter():
import re
re_cache = re.compile(r'([A-Za-z0-9_\-]+)?:?([A-Za-z0-9_\-]+)?=(.*)$')
with open(join(CMAKE_DIR, "CMakeCache.txt"), 'r', encoding='utf-8') as cache_file:
for l in cache_file:
match = re_cache.match(l.strip())
if match is not None:
var, type_, val = match.groups()
yield (var, type_ or "", val)
def cmake_cache_var(var):
for var_iter, type_iter, value_iter in cmake_cache_var_iter():
if var == var_iter:
return value_iter
cache_file = open(join(CMAKE_DIR, "CMakeCache.txt"))
lines = [l_strip for l in cache_file for l_strip in (l.strip(),) if l_strip if not l_strip.startswith("//") if not l_strip.startswith("#")]
cache_file.close()
for l in lines:
if l.split(":")[0] == var:
return l.split("=", 1)[-1]
return None

View File

@@ -52,8 +52,6 @@ BF_CXX = '/usr'
WITH_BF_STATICCXX = False
BF_CXX_LIB_STATIC = '${BF_CXX}/lib/libstdc++.a'
WITH_BF_AUDASPACE = True
# we use simply jack framework
WITH_BF_JACK = True
BF_JACK = '/Library/Frameworks/Jackmp.framework'
@@ -215,12 +213,6 @@ WITH_BF_FREESTYLE = True
#OpenMP ( will be checked for compiler support and turned off eventually )
WITH_BF_OPENMP = True
WITH_BF_OPENSUBDIV = False
BF_OPENSUBDIV = LIBDIR + '/opensubdiv'
BF_OPENSUBDIV_INC = '${BF_OPENSUBDIV}/include'
BF_OPENSUBDIV_LIB = 'osdCPU osdGPU'
BF_OPENSUBDIV_LIBPATH = '${BF_OPENSUBDIV}/lib'
#Ray trace optimization
WITH_BF_RAYOPTIMIZATION = True
BF_RAYOPTIMIZATION_SSE_FLAGS = []

View File

@@ -26,8 +26,6 @@ BF_CXX = '/usr'
WITH_BF_STATICCXX = False
BF_CXX_LIB_STATIC = '${BF_CXX}/lib/libstdc++.a'
WITH_BF_AUDASPACE = True
WITH_BF_JACK = False
BF_JACK = '/usr'
BF_JACK_INC = '${BF_JACK}/include/jack'
@@ -228,14 +226,6 @@ BF_3DMOUSE_LIB_STATIC = '${BF_3DMOUSE_LIBPATH}/libspnav.a'
#Freestyle
WITH_BF_FREESTYLE = True
WITH_BF_OPENSUBDIV = False
WITH_BF_STATICOPENSUBDIV = False
BF_OPENSUBDIV = '/usr'
BF_OPENSUBDIV_INC = '${BF_OPENSUBDIV}/include'
BF_OPENSUBDIV_LIB = 'osdCPU osdGPU'
BF_OPENSUBDIV_LIB_STATIC = '${BF_OPENSUBDIV_LIBPATH}/libosdGPU.a ${BF_OPENSUBDIV_LIBPATH}/libosdCPU.a'
BF_OPENSUBDIV_LIBPATH = '${BF_OPENSUBDIV}/lib'
##
CC = 'gcc'
CXX = 'g++'

View File

@@ -23,8 +23,6 @@ BF_FFMPEG_LIBPATH = LIBDIR + '/ffmpeg/lib'
BF_FFMPEG_INC = LIBDIR + '/ffmpeg/include'
BF_FFMPEG_DLL = '${BF_FFMPEG_LIBPATH}/avformat-55.dll ${BF_FFMPEG_LIBPATH}/avcodec-55.dll ${BF_FFMPEG_LIBPATH}/avdevice-55.dll ${BF_FFMPEG_LIBPATH}/avutil-52.dll ${BF_FFMPEG_LIBPATH}/swscale-2.dll'
WITH_BF_AUDASPACE = True
WITH_BF_JACK = False
BF_JACK = LIBDIR + '/jack'
BF_JACK_INC = '${BF_JACK}/include'
@@ -168,12 +166,6 @@ BF_BOOST_LIB = 'boost_date_time-mgw46-mt-s-1_49 boost_filesystem-mgw46-mt-s-1_49
BF_BOOST_LIB_INTERNATIONAL = 'boost_locale-mgw46-mt-s-1_49'
BF_BOOST_LIBPATH = '${BF_BOOST}/lib'
WITH_BF_OPENSUBDIV = False
BF_OPENSUBDIV = LIBDIR + '/opensubdiv'
BF_OPENSUBDIV_INC = '${BF_OPENSUBDIV}/include'
BF_OPENSUBDIV_LIB = 'osdCPU osdGPU'
BF_OPENSUBDIV_LIBPATH = '${BF_OPENSUBDIV}/lib'
#Ray trace optimization
WITH_BF_RAYOPTIMIZATION = True
BF_RAYOPTIMIZATION_SSE_FLAGS = ['-msse']

View File

@@ -42,8 +42,6 @@ BF_ICONV_INC = '${BF_ICONV}/include'
BF_ICONV_LIB = 'iconv'
BF_ICONV_LIBPATH = '${BF_ICONV}/lib'
WITH_BF_AUDASPACE = True
WITH_BF_JACK = False
BF_JACK = LIBDIR + '/jack'
BF_JACK_INC = '${BF_JACK}/include ${BF_FFMPEG}/include/msvc'
@@ -210,12 +208,6 @@ BF_RAYOPTIMIZATION_SSE_FLAGS = ['/arch:SSE']
#Freestyle
WITH_BF_FREESTYLE = True
WITH_BF_OPENSUBDIV = True
BF_OPENSUBDIV = LIBDIR + '/opensubdiv'
BF_OPENSUBDIV_INC = '${BF_OPENSUBDIV}/include'
BF_OPENSUBDIV_LIB = 'osdCPU osdGPU'
BF_OPENSUBDIV_LIBPATH = '${BF_OPENSUBDIV}/lib'
WITH_BF_STATICOPENGL = False
BF_OPENGL_INC = '${BF_OPENGL}/include'
BF_OPENGL_LIBINC = '${BF_OPENGL}/lib'

View File

@@ -22,8 +22,6 @@ BF_FFMPEG_LIBPATH = LIBDIR + '/ffmpeg/lib'
BF_FFMPEG_INC = LIBDIR + '/ffmpeg/include'
BF_FFMPEG_DLL = '${BF_FFMPEG_LIBPATH}/avformat-53.dll ${BF_FFMPEG_LIBPATH}/avcodec-53.dll ${BF_FFMPEG_LIBPATH}/avdevice-53.dll ${BF_FFMPEG_LIBPATH}/avutil-51.dll ${BF_FFMPEG_LIBPATH}/swscale-2.dll ${BF_FFMPEG_LIBPATH}/swresample-0.dll ${BF_FFMPEG_LIBPATH}/xvidcore.dll'
WITH_BF_AUDASPACE = True
WITH_BF_JACK = False
BF_JACK = LIBDIR + '/jack'
BF_JACK_INC = '${BF_JACK}/include'
@@ -167,12 +165,6 @@ BF_BOOST_LIB = 'boost_date_time-mgw47-mt-s-1_49 boost_date_time-mgw47-mt-sd-1_49
BF_BOOST_LIB_INTERNATIONAL = ' boost_locale-mgw47-mt-s-1_49 boost_locale-mgw47-mt-sd-1_49'
BF_BOOST_LIBPATH = '${BF_BOOST}/lib'
WITH_BF_OPENSUBDIV = False
BF_OPENSUBDIV = LIBDIR + '/opensubdiv'
BF_OPENSUBDIV_INC = '${BF_OPENSUBDIV}/include'
BF_OPENSUBDIV_LIB = 'osdCPU osdGPU'
BF_OPENSUBDIV_LIBPATH = '${BF_OPENSUBDIV}/lib'
#Ray trace optimization
WITH_BF_RAYOPTIMIZATION = True
BF_RAYOPTIMIZATION_SSE_FLAGS = ['-mmmx', '-msse', '-msse2']

View File

@@ -55,8 +55,6 @@ BF_SDL_INC = '${BF_SDL}/include'
BF_SDL_LIB = 'SDL2.lib'
BF_SDL_LIBPATH = '${BF_SDL}/lib'
WITH_BF_AUDASPACE = True
WITH_BF_JACK = False
BF_PTHREADS = LIBDIR + '/pthreads'
@@ -214,12 +212,6 @@ BF_RAYOPTIMIZATION_SSE_FLAGS = ['']
#Freestyle
WITH_BF_FREESTYLE = True
WITH_BF_OPENSUBDIV = True
BF_OPENSUBDIV = LIBDIR + '/opensubdiv'
BF_OPENSUBDIV_INC = '${BF_OPENSUBDIV}/include'
BF_OPENSUBDIV_LIB = 'osdCPU osdGPU'
BF_OPENSUBDIV_LIBPATH = '${BF_OPENSUBDIV}/lib'
WITH_BF_STATICOPENGL = False
BF_OPENGL_INC = '${BF_OPENGL}/include'
BF_OPENGL_LIBINC = '${BF_OPENGL}/lib'

View File

@@ -242,11 +242,6 @@ def setup_staticlibs(lenv):
if lenv['WITH_BF_STATIC3DMOUSE']:
statlibs += Split(lenv['BF_3DMOUSE_LIB_STATIC'])
if lenv['WITH_BF_OPENSUBDIV']:
libincs += Split(lenv['BF_OPENSUBDIV_LIBPATH'])
if lenv['WITH_BF_STATICOPENSUBDIV']:
statlibs += Split(lenv['BF_OPENSUBDIV_LIB_STATIC'])
# setting this last so any overriding of manually libs could be handled
if lenv['OURPLATFORM'] not in ('win32-vc', 'win32-mingw', 'win64-vc', 'linuxcross', 'win64-mingw'):
# We must remove any previous items defining this path, for same reason stated above!
@@ -349,13 +344,6 @@ def setup_syslibs(lenv):
if not lenv['WITH_BF_STATICPNG']:
syslibs += Split(lenv['BF_PNG_LIB'])
if lenv['WITH_BF_OPENSUBDIV']:
if not lenv['WITH_BF_STATICOPENSUBDIV']:
if lenv['BF_DEBUG'] and lenv['OURPLATFORM'] in ('win32-vc', 'win64-vc', 'win32-mingw', 'win64-mingw'):
syslibs += [osdlib+'_d' for osdlib in Split(lenv['BF_OPENSUBDIV_LIB'])]
else:
syslibs += Split(lenv['BF_OPENSUBDIV_LIB'])
# Hack to pass OSD libraries to linker before extern_{clew,cuew}
for syslib in create_blender_liblist(lenv, 'system'):
syslibs.append(os.path.basename(syslib))

View File

@@ -107,7 +107,6 @@ def print_arguments(args, bc):
def validate_arguments(args, bc):
opts_list = [
'WITH_BF_FREESTYLE', 'WITH_BF_PYTHON', 'WITH_BF_PYTHON_SAFETY', 'WITH_BF_PYTHON_SECURITY', 'BF_PYTHON', 'BF_PYTHON_VERSION', 'BF_PYTHON_INC', 'BF_PYTHON_BINARY', 'BF_PYTHON_LIB', 'BF_PYTHON_LIBPATH', 'BF_PYTHON_LIBPATH_ARCH', 'WITH_BF_STATICPYTHON', 'WITH_OSX_STATICPYTHON', 'BF_PYTHON_LIB_STATIC', 'BF_PYTHON_DLL', 'BF_PYTHON_ABI_FLAGS',
'WITH_BF_AUDASPACE', 'BF_AUDASPACE_C_INC', 'BF_AUDASPACE_PY_INC', 'BF_AUDASPACE_DEF',
'WITH_BF_OPENAL', 'BF_OPENAL', 'BF_OPENAL_INC', 'BF_OPENAL_LIB', 'BF_OPENAL_LIBPATH', 'WITH_BF_STATICOPENAL', 'BF_OPENAL_LIB_STATIC',
'WITH_BF_SDL', 'BF_SDL', 'BF_SDL_INC', 'BF_SDL_LIB', 'BF_SDL_LIBPATH', 'WITH_BF_SDL_DYNLOAD',
'WITH_BF_JACK', 'BF_JACK', 'BF_JACK_INC', 'BF_JACK_LIB', 'BF_JACK_LIBPATH', 'WITH_BF_JACK_DYNLOAD',
@@ -183,8 +182,7 @@ def validate_arguments(args, bc):
'WITH_BF_BOOST', 'WITH_BF_STATICBOOST', 'BF_BOOST', 'BF_BOOST_INC', 'BF_BOOST_LIB', 'BF_BOOST_LIB_INTERNATIONAL', 'BF_BOOST_LIB_STATIC', 'BF_BOOST_LIBPATH',
'WITH_BF_LIBMV', 'WITH_BF_LIBMV_SCHUR_SPECIALIZATIONS',
'WITH_BF_CYCLES_OSL', 'WITH_BF_STATICOSL', 'BF_OSL', 'BF_OSL_INC', 'BF_OSL_LIB', 'BF_OSL_LIBPATH', 'BF_OSL_LIB_STATIC', 'BF_OSL_COMPILER',
'WITH_BF_LLVM', 'WITH_BF_STATICLLVM', 'BF_LLVM', 'BF_LLVM_LIB', 'BF_LLVM_LIBPATH', 'BF_LLVM_LIB_STATIC', 'BF_PROGRAM_LINKFLAGS',
'WITH_BF_OPENSUBDIV', 'WITH_BF_STATICOPENSUBDIV', 'BF_OPENSUBDIV', 'BF_OPENSUBDIV_INC', 'BF_OPENSUBDIV_LIB', 'BF_OPENSUBDIV_LIBPATH', 'BF_OPENSUBDIV_LIB_STATIC'
'WITH_BF_LLVM', 'WITH_BF_STATICLLVM', 'BF_LLVM', 'BF_LLVM_LIB', 'BF_LLVM_LIBPATH', 'BF_LLVM_LIB_STATIC', 'BF_PROGRAM_LINKFLAGS'
]
# Have options here that scons expects to be lists
@@ -299,11 +297,6 @@ def read_opts(env, cfg, args):
('BF_OPENAL_LIBPATH', 'Path to OpenAL library', ''),
(BoolVariable('WITH_BF_STATICOPENAL', 'Staticly link to openal', False)),
(BoolVariable('WITH_BF_AUDASPACE', 'Build with audaspace if true', True)),
('BF_AUDASPACE_C_INC', 'audaspace-c include path', ''),
('BF_AUDASPACE_PY_INC', 'audaspace-py include path', ''),
('BF_AUDASPACE_DEF', 'audaspace defines', ''),
(BoolVariable('WITH_BF_SDL', 'Use SDL if true', False)),
('BF_SDL', 'SDL base path', ''),
('BF_SDL_INC', 'SDL include path', ''),
@@ -663,14 +656,6 @@ def read_opts(env, cfg, args):
('BF_PROGRAM_LINKFLAGS', 'Link flags applied only to final binaries (blender and blenderplayer, not makesrna/makesdna)', ''),
(BoolVariable('WITH_BF_OPENSUBDIV', 'Build with OpenSubdiv library', False)),
(BoolVariable('WITH_BF_STATICOPENSUBDIV', 'Staticly link to OpenColorIO', False)),
('BF_OPENSUBDIV', 'OpenSubdiv root path', ''),
('BF_OPENSUBDIV_INC', 'OpenSubdiv include path', ''),
('BF_OPENSUBDIV_LIB', 'OpenSubdiv library', ''),
('BF_OPENSUBDIV_LIBPATH', 'OpenSubdiv library path', ''),
('BF_OPENSUBDIV_LIB_STATIC', 'OpenSubdiv static library', ''),
(BoolVariable('WITH_BF_CPP11', '"Build with C++11 standard enabled, for development use only!', False)),
(BoolVariable('WITH_BF_LEGACY_DEPSGRAPH', 'Build Blender with legacy dependency graph', True)),

104
doc/build_systems/cmake.txt Normal file
View File

@@ -0,0 +1,104 @@
Blender CMake build system
============================
Contents
---------------
1. Introduction
2. Obtaining CMake
3. Building Blender
4. Generic Setup
5. Configuring the build after SVN updates
1. Introduction
---------------
This document describes general usage of the new CMake scripts. The
inner workings will be described in blender-cmake-dev.txt (TODO).
2. Obtaining CMake
------------------
CMake for can either be downloaded using your favorite package manager
or is also available from the CMake website at http://www.cmake.org
The website also contains some documentation on CMake usage but I found
the man page alone pretty helpful.
3. Building Blender
-------------------
Building Blender requires obtaining a compiler, library dependencies,
and correct setup depending on the system. For details on how to set
up a build on various operating systems, see the wiki documentation:
http://wiki.blender.org/index.php/Dev:Doc/Building_Blender
4. Generic Setup
----------------
CMake allows one to generate the build project files and binary objects
outside the source tree which can be pretty handy in working and experimenting
with different Blender configurations (Audio/NoAudio, GameEngine/NoGameEngine etc.)
while maintaining a clean source tree. It also makes it possible to generate files
for different build systems on the same source tree. This also has benefits for
general SVN management for the developer as patches and submit logs are much cleaner.
Create a directory outside the blender source tree where you would like to build
Blender (from now on called $BLENDERBUILD). On the commandline you can then run
the cmake command to generate your initial build files. First just run 'cmake' which
will inform you what the available generators are. Thn you can run
'cmake -G generator $BLENDERSOURCE' to generate the build files. Here is an example
of all this for Xcode:
% mkdir $BLENDERBUILD
% cd $BLENDERBUILD
% cmake
...
...
--version [file] = Show program name/version banner and exit.
Generators
The following generators are available on this platform:
KDevelop3 = Generates KDevelop 3 project files.
Unix Makefiles = Generates standard UNIX makefiles.
Xcode = Generate XCode project files.
% cmake -G Xcode $BLENDERSOURCE
...
...
-- Configuring blender
-- Configuring blenderplayer
-- Configuring done
-- Generating done
-- Build files have been written to: $BLENDERBUILD
This will generate the build files with default values. Specific features can
be enabled or disabled by running the ccmake "GUI" from $BLENDERBUILD as follows:
% ccmake $BLENDERSOURCE
A number of options appear which can be changed depending on your needs and
available dependencies (e.g. setting WITH_OPENEXR to OFF will disable support
for OpenEXR). It will also allow you to override default and detected paths
(e.g. Python directories) and compile and link flags. When you are satisfied
used ccmake to re-configure the build files and exit.
It is also possible to use the commandline of 'cmake' to override certain
of these settings.
5. Configuring the build after SVN updates
------------------------------------------
The $BLENDERBUILD directory maintains a file called CMakeCache.txt which
remembers the initial run's settings for subsequent generation runs. After
SVN updates that contain changes to the build system, rebuilding Blender will
automatically invoke CMake to regenerate the CMakeCache.txt and other files
as needed.
/Jacques Beaurain (jbinto)

View File

@@ -7,7 +7,7 @@
* These pages document the source code of blender.
*
* \subsection implinks Important Links
* - <a href="http://developer.blender.org">developer.blender.org</a> with bug tracker.
* - <a href="http://developer.blender.org">developer.blender.org</a> with bug tracker
* - <a href="http://wiki.blender.org/index.php/Dev:Contents">Development documents</a> on our wiki.
*
* \subsection blother Other

View File

@@ -11,6 +11,7 @@
/** \defgroup bmesh BMesh
* \ingroup blender
*/
/** \defgroup texture Texturing */
/** \defgroup compositor Compositing */
/** \defgroup python Python
@@ -321,7 +322,7 @@
* \ingroup gui
*/
/** \defgroup externformats External Formats */
/** \defgroup externformats external formats */
/** \defgroup collada COLLADA
* \ingroup externformats

View File

@@ -2,8 +2,8 @@
Texture Replacement
+++++++++++++++++++
Example of how to replace a texture in game with an external image.
``createTexture()`` and ``removeTexture()`` are to be called from a
module Python Controller.
createTexture() and removeTexture() are to be called from a module Python
Controller.
"""
from bge import logic
from bge import texture

View File

@@ -1,8 +1,7 @@
"""
Basic Video Playback
++++++++++++++++++++
Example of how to replace a texture in game with a video. It needs to run
everyframe.
Example of how to replace a texture in game with a video. It needs to run everyframe
"""
import bge
from bge import texture

View File

@@ -31,7 +31,7 @@ class SimpleMouseOperator(bpy.types.Operator):
y = bpy.props.IntProperty()
def execute(self, context):
# rather than printing, use the report function,
# rather then printing, use the report function,
# this way the message appears in the header,
self.report({'INFO'}, "Mouse coords are %d %d" % (self.x, self.y))
return {'FINISHED'}

View File

@@ -1,7 +1,7 @@
"""
Note that when keying data paths which contain nested properties this must be
done from the :class:`ID` subclass, in this case the :class:`Armature` rather
than the bone.
then the bone.
"""
import bpy

View File

@@ -32,7 +32,14 @@ Functions
:arg physicsid_2: The physics id of the second object in constraint.
:type physicsid_2: int
:arg constraint_type: The type of the constraint, see `Create Constraint Constants`_.
:arg constraint_type: The type of the constraint, one of...
- :class:`POINTTOPOINT_CONSTRAINT`
- :class:`LINEHINGE_CONSTRAINT`
- :class:`ANGULAR_CONSTRAINT`
- :class:`CONETWIST_CONSTRAINT`
- :class:`VEHICLE_CONSTRAINT`
- :class:`GENERIC_6DOF_CONSTRAINT`
:type constraint_type: int
@@ -145,7 +152,22 @@ Functions
Sets the debug mode.
:arg mode: The new debug mode, see `Debug Mode Constants`_.
:arg mode: The new debug mode.
- :class:`DBG_NODEBUG`
- :class:`DBG_DRAWWIREFRAME`
- :class:`DBG_DRAWAABB`
- :class:`DBG_DRAWFREATURESTEXT`
- :class:`DBG_DRAWCONTACTPOINTS`
- :class:`DBG_NOHELPTEXT`
- :class:`DBG_DRAWTEXT`
- :class:`DBG_PROFILETIMINGS`
- :class:`DBG_ENABLESATCOMPARISION`
- :class:`DBG_DISABLEBULLETLCP`
- :class:`DBG_ENABLECCD`
- :class:`DBG_DRAWCONSTRAINTS`
- :class:`DBG_DRAWCONSTRAINTLIMITS`
- :class:`DBG_FASTWIREFRAME`
:type mode: int

File diff suppressed because it is too large Load Diff

View File

@@ -89,48 +89,6 @@ base class --- :class:`PyObjectPlus`
:return: the material's shader
:rtype: :class:`BL_Shader`
.. attribute:: alpha
The material's alpha transparency.
:type: float between 0.0 and 1.0 inclusive
.. attribute:: hardness
How hard (sharp) the material's specular reflection is.
:type: integer between 1 and 511 inclusive
.. attribute:: emit
Amount of light to emit.
:type: float between 0.0 and 2.0 inclusive
.. attribute:: specularIntensity
How intense (bright) the material's specular reflection is.
:type: float between 0.0 and 1.0 inclusive
.. attribute:: diffuseIntensity
The material's amount of diffuse reflection.
:type: float between 0.0 and 1.0 inclusive
.. attribute:: specularColor
The material's specular color.
:type: :class:`mathutils.Color`
.. attribute:: diffuseColor
The material's diffuse color.
:type: :class:`mathutils.Color`
.. method:: setBlending(src, dest)
Set the pixel color arithmetic functions.

View File

@@ -51,18 +51,6 @@ base class --- :class:`KX_GameObject`
:type: float
.. attribute:: shift_x
The camera's horizontal shift.
:type: float
.. attribute:: shift_y
The camera's vertical shift.
:type: float
.. attribute:: perspective
True if this camera has a perspective transform, False for an orthographic projection.

View File

@@ -137,7 +137,7 @@ base class --- :class:`SCA_IObject`
.. note::
A value of 0.0 disables this option (rather than setting it stationary).
A value of 0.0 disables this option (rather then setting it stationary).
.. attribute:: angularVelocityMin
@@ -972,16 +972,6 @@ base class --- :class:`SCA_IObject`
:return: The current frame of the action
:rtype: float
.. method:: getActionName(layer=0)
Gets the name of the current action playing in the supplied layer.
:arg layer: The layer that you want to get the action name from.
:type layer: integer
:return: The name of the current action
:rtype: string
.. method:: setActionFrame(frame, layer=0)
Set the current frame of the action playing in the supplied layer.

View File

@@ -51,7 +51,7 @@ base class --- :class:`SCA_IObject`
.. attribute:: materials
:type: list of :class:`KX_BlenderMaterial` type
:type: list of :class:`KX_BlenderMaterial` or :class:`KX_PolygonMaterial` types
.. attribute:: numPolygons

View File

@@ -23,7 +23,7 @@ base class --- :class:`SCA_IObject`
The material of the polygon.
:type: :class:`KX_BlenderMaterial`
:type: :class:`KX_PolygonMaterial` or :class:`KX_BlenderMaterial`
.. attribute:: texture_name
@@ -84,7 +84,7 @@ base class --- :class:`SCA_IObject`
.. method:: getMaterial()
:return: The polygon material
:rtype: :class:`KX_BlenderMaterial`
:rtype: :class:`KX_PolygonMaterial` or :class:`KX_BlenderMaterial`
.. method:: getTextureName()

View File

@@ -1,4 +1,4 @@
KX_WorldInfo(PyObjectPlus)
KX_WordlInfo(PyObjectPlus)
=============================
.. module:: bge.types
@@ -7,7 +7,7 @@ base class --- :class:`PyObjectPlus`
.. class:: KX_WorldInfo(PyObjectPlus)
A world object.
A wolrd object.
.. code-block:: python

View File

@@ -2,8 +2,7 @@
Gotchas
*******
This document attempts to help you work with the Blender API in areas
that can be troublesome and avoid practices that are known to give instability.
This document attempts to help you work with the Blender API in areas that can be troublesome and avoid practices that are known to give instability.
.. _using_operators:
@@ -11,15 +10,16 @@ that can be troublesome and avoid practices that are known to give instability.
Using Operators
===============
Blender's operators are tools for users to access, that Python can access them too is very useful
nevertheless operators have limitations that can make them cumbersome to script.
Blender's operators are tools for users to access, that python can access them too is very useful nevertheless operators have limitations that can make them cumbersome to script.
Main limits are...
- Can't pass data such as objects, meshes or materials to operate on (operators use the context instead)
- The return value from calling an operator gives the success (if it finished or was canceled),
* Can't pass data such as objects, meshes or materials to operate on (operators use the context instead)
* The return value from calling an operator gives the success (if it finished or was canceled),
in some cases it would be more logical from an API perspective to return the result of the operation.
- Operators poll function can fail where an API function would raise an exception giving details on exactly why.
* Operators poll function can fail where an API function would raise an exception giving details on exactly why.
Why does an operator's poll fail?
@@ -32,28 +32,20 @@ When calling an operator gives an error like this:
Which raises the question as to what the correct context might be?
Typically operators check for the active area type, a selection or active object they can operate on,
but some operators are more picky about when they run.
Typically operators check for the active area type, a selection or active object they can operate on, but some operators are more picky about when they run.
In most cases you can figure out what context an operator needs
simply be seeing how it's used in Blender and thinking about what it does.
In most cases you can figure out what context an operator needs simply be seeing how it's used in Blender and thinking about what it does.
Unfortunately if you're still stuck - the only way to **really** know
whats going on is to read the source code for the poll function and see what its checking.
Unfortunately if you're still stuck - the only way to **really** know whats going on is to read the source code for the poll function and see what its checking.
For Python operators it's not so hard to find the source
since it's included with Blender and the source file/line is included in the operator reference docs.
For python operators it's not so hard to find the source since it's included with Blender and the source file/line is included in the operator reference docs.
Downloading and searching the C code isn't so simple,
especially if you're not familiar with the C language but by searching the
operator name or description you should be able to find the poll function with no knowledge of C.
Downloading and searching the C code isn't so simple, especially if you're not familiar with the C language but by searching the operator name or description you should be able to find the poll function with no knowledge of C.
.. note::
Blender does have the functionality for poll functions to describe why they fail,
but its currently not used much, if you're interested to help improve our API
feel free to add calls to ``CTX_wm_operator_poll_msg_set`` where its not obvious why poll fails.
Blender does have the functionality for poll functions to describe why they fail, but its currently not used much, if you're interested to help improve our API feel free to add calls to ``CTX_wm_operator_poll_msg_set`` where its not obvious why poll fails.
>>> bpy.ops.gpencil.draw()
RuntimeError: Operator bpy.ops.gpencil.draw.poll() Failed to find Grease Pencil data to draw into
@@ -62,45 +54,36 @@ operator name or description you should be able to find the poll function with n
The operator still doesn't work!
--------------------------------
Certain operators in Blender are only intended for use in a specific context,
some operators for example are only called from the properties window where they check the current material,
modifier or constraint.
Certain operators in Blender are only intended for use in a specific context, some operators for example are only called from the properties window where they check the current material, modifier or constraint.
Examples of this are:
- :mod:`bpy.ops.texture.slot_move`
- :mod:`bpy.ops.constraint.limitdistance_reset`
- :mod:`bpy.ops.object.modifier_copy`
- :mod:`bpy.ops.buttons.file_browse`
* :mod:`bpy.ops.texture.slot_move`
* :mod:`bpy.ops.constraint.limitdistance_reset`
* :mod:`bpy.ops.object.modifier_copy`
* :mod:`bpy.ops.buttons.file_browse`
Another possibility is that you are the first person to attempt to use this operator
in a script and some modifications need to be made to the operator to run in a different context,
if the operator should logically be able to run but fails when accessed from a script
it should be reported to the bug tracker.
Another possibility is that you are the first person to attempt to use this operator in a script and some modifications need to be made to the operator to run in a different context, if the operator should logically be able to run but fails when accessed from a script it should be reported to the bug tracker.
Stale Data
==========
No updates after setting values
-------------------------------
Sometimes you want to modify values from Python and immediately access the updated values, eg:
Sometimes you want to modify values from python and immediately access the updated values, eg:
Once changing the objects :class:`bpy.types.Object.location`
you may want to access its transformation right after from :class:`bpy.types.Object.matrix_world`,
but this doesn't work as you might expect.
Once changing the objects :class:`bpy.types.Object.location` you may want to access its transformation right after from :class:`bpy.types.Object.matrix_world`, but this doesn't work as you might expect.
Consider the calculations that might go into working out the object's final transformation, this includes:
- animation function curves.
- drivers and their Python expressions.
- constraints
- parent objects and all of their f-curves, constraints etc.
* animation function curves.
* drivers and their pythons expressions.
* constraints
* parent objects and all of their f-curves, constraints etc.
To avoid expensive recalculations every time a property is modified,
Blender defers making the actual calculations until they are needed.
To avoid expensive recalculations every time a property is modified, Blender defers making the actual calculations until they are needed.
However, while the script runs you may want to access the updated values.
In this case you need to call :class:`bpy.types.Scene.update` after modifying values, for example:
@@ -111,9 +94,7 @@ In this case you need to call :class:`bpy.types.Scene.update` after modifying va
bpy.context.scene.update()
Now all dependent data (child objects, modifiers, drivers... etc)
has been recalculated and is available to the script.
Now all dependent data (child objects, modifiers, drivers... etc) has been recalculated and is available to the script.
Can I redraw during the script?
-------------------------------
@@ -122,33 +103,23 @@ The official answer to this is no, or... *"You don't want to do that"*.
To give some background on the topic...
While a script executes Blender waits for it to finish and is effectively locked until its done,
while in this state Blender won't redraw or respond to user input.
Normally this is not such a problem because scripts distributed with Blender
tend not to run for an extended period of time,
nevertheless scripts *can* take ages to execute and its nice to see whats going on in the view port.
While a script executes Blender waits for it to finish and is effectively locked until its done, while in this state Blender won't redraw or respond to user input.
Normally this is not such a problem because scripts distributed with Blender tend not to run for an extended period of time, nevertheless scripts *can* take ages to execute and its nice to see whats going on in the view port.
Tools that lock Blender in a loop and redraw are highly discouraged
since they conflict with Blenders ability to run multiple operators
at once and update different parts of the interface as the tool runs.
Tools that lock Blender in a loop and redraw are highly discouraged since they conflict with Blenders ability to run multiple operators at once and update different parts of the interface as the tool runs.
So the solution here is to write a **modal** operator, that is - an operator which defines a modal() function,
See the modal operator template in the text editor.
So the solution here is to write a **modal** operator, that is - an operator which defines a modal() function, See the modal operator template in the text editor.
Modal operators execute on user input or setup their own timers to run frequently,
they can handle the events or pass through to be handled by the keymap or other modal operators.
Modal operators execute on user input or setup their own timers to run frequently, they can handle the events or pass through to be handled by the keymap or other modal operators.
Transform, Painting, Fly-Mode and File-Select are example of a modal operators.
Writing modal operators takes more effort than a simple ``for`` loop
that happens to redraw but is more flexible and integrates better with Blenders design.
Writing modal operators takes more effort than a simple ``for`` loop that happens to redraw but is more flexible and integrates better with Blenders design.
**Ok, Ok! I still want to draw from Python**
**Ok, Ok! I still want to draw from python**
If you insist - yes its possible, but scripts that use this hack wont be considered
for inclusion in Blender and any issues with using it wont be considered bugs,
this is also not guaranteed to work in future releases.
If you insist - yes its possible, but scripts that use this hack wont be considered for inclusion in Blender and any issues with using it wont be considered bugs, this is also not guaranteed to work in future releases.
.. code-block:: python
@@ -158,18 +129,16 @@ this is also not guaranteed to work in future releases.
Modes and Mesh Access
=====================
When working with mesh data you may run into the problem where a script fails to run as expected in edit-mode.
This is caused by edit-mode having its own data which is only written back to the mesh when exiting edit-mode.
When working with mesh data you may run into the problem where a script fails to run as expected in edit-mode. This is caused by edit-mode having its own data which is only written back to the mesh when exiting edit-mode.
A common example is that exporters may access a mesh through ``obj.data`` (a :class:`bpy.types.Mesh`)
but the user is in edit-mode, where the mesh data is available but out of sync with the edit mesh.
A common example is that exporters may access a mesh through ``obj.data`` (a :class:`bpy.types.Mesh`) but the user is in edit-mode, where the mesh data is available but out of sync with the edit mesh.
In this situation you can...
- Exit edit-mode before running the tool.
- Explicitly update the mesh by calling :class:`bmesh.types.BMesh.to_mesh`.
- Modify the script to support working on the edit-mode data directly, see: :mod:`bmesh.from_edit_mesh`.
- Report the context as incorrect and only allow the script to run outside edit-mode.
* Exit edit-mode before running the tool.
* Explicitly update the mesh by calling :class:`bmesh.types.BMesh.to_mesh`.
* Modify the script to support working on the edit-mode data directly, see: :mod:`bmesh.from_edit_mesh`.
* Report the context as incorrect and only allow the script to run outside edit-mode.
.. _info_gotcha_mesh_faces:
@@ -177,55 +146,35 @@ In this situation you can...
NGons and Tessellation Faces
============================
Since 2.63 NGons are supported, this adds some complexity
since in some cases you need to access triangles/quads still (some exporters for example).
Since 2.63 NGons are supported, this adds some complexity since in some cases you need to access triangles/quads still (some exporters for example).
There are now 3 ways to access faces:
- :class:`bpy.types.MeshPolygon` -
this is the data structure which now stores faces in object mode
(access as ``mesh.polygons`` rather than ``mesh.faces``).
- :class:`bpy.types.MeshTessFace` -
the result of triangulating (tessellated) polygons,
the main method of face access in 2.62 or older (access as ``mesh.tessfaces``).
- :class:`bmesh.types.BMFace` -
the polygons as used in editmode.
* :class:`bpy.types.MeshPolygon` - this is the data structure which now stores faces in object mode (access as ``mesh.polygons`` rather then ``mesh.faces``).
* :class:`bpy.types.MeshTessFace` - the result of triangulating (tessellated) polygons, the main method of face access in 2.62 or older (access as ``mesh.tessfaces``).
* :class:`bmesh.types.BMFace` - the polygons as used in editmode.
For the purpose of the following documentation,
these will be referred to as polygons, tessfaces and bmesh-faces respectively.
For the purpose of the following documentation, these will be referred to as polygons, tessfaces and bmesh-faces respectively.
5+ sided faces will be referred to as ``ngons``.
Support Overview
----------------
.. list-table::
:header-rows: 1
:stub-columns: 1
+--------------+------------------------------+--------------------------------+--------------------------------+
|Usage |:class:`bpy.types.MeshPolygon`|:class:`bpy.types.MeshTessFace` |:class:`bmesh.types.BMFace` |
+==============+==============================+================================+================================+
|Import/Create |Bad (inflexible) |Fine (supported as upgrade path)|Best |
+--------------+------------------------------+--------------------------------+--------------------------------+
|Manipulate |Bad (inflexible) |Bad (loses ngons) |Best |
+--------------+------------------------------+--------------------------------+--------------------------------+
|Export/Output |Good (ngons) |Good (When ngons can't be used) |Good (ngons, memory overhead) |
+--------------+------------------------------+--------------------------------+--------------------------------+
* - Usage
- :class:`bpy.types.MeshPolygon`
- :class:`bpy.types.MeshTessFace`
- :class:`bmesh.types.BMFace`
* - Import/Create
- Poor *(inflexible)*
- Good *(supported as upgrade path)*
- Best
* - Manipulate
- Poor *(inflexible)*
- Poor *(loses ngons)*
- Best
* - Export/Output
- Good *(ngon support)*
- Good *(When ngons can't be used)*
- Good *(ngons, extra memory overhead)*
.. note::
Using the :mod:`bmesh` api is completely separate api from :mod:`bpy`,
typically you would would use one or the other based on the level of editing needed,
not simply for a different way to access faces.
Using the :mod:`bmesh` api is completely separate api from :mod:`bpy`, typically you would would use one or the other based on the level of editing needed, not simply for a different way to access faces.
Creating
@@ -233,18 +182,9 @@ Creating
All 3 datatypes can be used for face creation.
- polygons are the most efficient way to create faces but the data structure is _very_ rigid and inflexible,
you must have all your vertes and faces ready and create them all at once.
This is further complicated by the fact that each polygon does not store its own verts (as with tessfaces),
rather they reference an index and size in :class:`bpy.types.Mesh.loops` which are a fixed array too.
- tessfaces ideally should not be used for creating faces since they are really only tessellation cache of polygons,
however for scripts upgrading from 2.62 this is by far the most straightforward option.
This works by creating tessfaces and when finished -
they can be converted into polygons by calling :class:`bpy.types.Mesh.update`.
The obvious limitation is ngons can't be created this way.
- bmesh-faces are most likely the easiest way for new scripts to create faces,
since faces can be added one by one and the api has features intended for mesh manipulation.
While :class:`bmesh.types.BMesh` uses more memory it can be managed by only operating on one mesh at a time.
* polygons are the most efficient way to create faces but the data structure is _very_ rigid and inflexible, you must have all your vertes and faces ready and create them all at once. This is further complicated by the fact that each polygon does not store its own verts (as with tessfaces), rather they reference an index and size in :class:`bpy.types.Mesh.loops` which are a fixed array too.
* tessfaces ideally should not be used for creating faces since they are really only tessellation cache of polygons, however for scripts upgrading from 2.62 this is by far the most straightforward option. This works by creating tessfaces and when finished - they can be converted into polygons by calling :class:`bpy.types.Mesh.update`. The obvious limitation is ngons can't be created this way.
* bmesh-faces are most likely the easiest way for new scripts to create faces, since faces can be added one by one and the api has features intended for mesh manipulation. While :class:`bmesh.types.BMesh` uses more memory it can be managed by only operating on one mesh at a time.
Editing
@@ -252,24 +192,18 @@ Editing
Editing is where the 3 data types vary most.
- Polygons are very limited for editing,
changing materials and options like smooth works but for anything else
they are too inflexible and are only intended for storage.
- Tessfaces should not be used for editing geometry because doing so will cause existing ngons to be tessellated.
- BMesh-Faces are by far the best way to manipulate geometry.
* polygons are very limited for editing, changing materials and options like smooth works but for anything else they are too inflexible and are only intended for storage.
* tessfaces should not be used for editing geometry because doing so will cause existing ngons to be tessellated.
* bmesh-faces are by far the best way to manipulate geometry.
Exporting
---------
All 3 data types can be used for exporting,
the choice mostly depends on whether the target format supports ngons or not.
All 3 data types can be used for exporting, the choice mostly depends on whether the target format supports ngons or not.
- Polygons are the most direct & efficient way to export providing they convert into the output format easily enough.
- Tessfaces work well for exporting to formats which dont support ngons,
in fact this is the only place where their use is encouraged.
- BMesh-Faces can work for exporting too but may not be necessary if polygons can be used
since using bmesh gives some overhead because its not the native storage format in object mode.
* polygons are the most direct & efficient way to export providing they convert into the output format easily enough.
* tessfaces work well for exporting to formats which dont support ngons, in fact this is the only place where their use is encouraged.
* bmesh-faces can work for exporting too but may not be necessary if polygons can be used since using bmesh gives some overhead because its not the native storage format in object mode.
Upgrading Importers from 2.62
@@ -279,9 +213,9 @@ Importers can be upgraded to work with only minor changes.
The main change to be made is used the tessellation versions of each attribute.
- mesh.faces --> :class:`bpy.types.Mesh.tessfaces`
- mesh.uv_textures --> :class:`bpy.types.Mesh.tessface_uv_textures`
- mesh.vertex_colors --> :class:`bpy.types.Mesh.tessface_vertex_colors`
* mesh.faces --> :class:`bpy.types.Mesh.tessfaces`
* mesh.uv_textures --> :class:`bpy.types.Mesh.tessface_uv_textures`
* mesh.vertex_colors --> :class:`bpy.types.Mesh.tessface_vertex_colors`
Once the data is created call :class:`bpy.types.Mesh.update` to convert the tessfaces into polygons.
@@ -289,9 +223,7 @@ Once the data is created call :class:`bpy.types.Mesh.update` to convert the tess
Upgrading Exporters from 2.62
-----------------------------
For exporters the most direct way to upgrade is to use tessfaces as with importing
however its important to know that tessfaces may **not** exist for a mesh,
the array will be empty as if there are no faces.
For exporters the most direct way to upgrade is to use tessfaces as with importing however its important to know that tessfaces may **not** exist for a mesh, the array will be empty as if there are no faces.
So before accessing tessface data call: :class:`bpy.types.Mesh.update` ``(calc_tessface=True)``.
@@ -299,8 +231,7 @@ So before accessing tessface data call: :class:`bpy.types.Mesh.update` ``(calc_t
EditBones, PoseBones, Bone... Bones
===================================
Armature Bones in Blender have three distinct data structures that contain them.
If you are accessing the bones through one of them, you may not have access to the properties you really need.
Armature Bones in Blender have three distinct data structures that contain them. If you are accessing the bones through one of them, you may not have access to the properties you really need.
.. note::
@@ -310,9 +241,7 @@ If you are accessing the bones through one of them, you may not have access to t
Edit Bones
----------
``bpy.context.object.data.edit_bones`` contains a editbones;
to access them you must set the armature mode to edit mode first (editbones do not exist in object or pose mode).
Use these to create new bones, set their head/tail or roll, change their parenting relationships to other bones, etc.
``bpy.context.object.data.edit_bones`` contains a editbones; to access them you must set the armature mode to edit mode first (editbones do not exist in object or pose mode). Use these to create new bones, set their head/tail or roll, change their parenting relationships to other bones, etc.
Example using :class:`bpy.types.EditBone` in armature editmode:
@@ -332,9 +261,7 @@ Returns an editbone only in edit mode.
Bones (Object Mode)
-------------------
``bpy.context.object.data.bones`` contains bones.
These *live* in object mode, and have various properties you can change,
note that the head and tail properties are read-only.
``bpy.context.object.data.bones`` contains bones. These *live* in object mode, and have various properties you can change, note that the head and tail properties are read-only.
Example using :class:`bpy.types.Bone` in object or pose mode:
@@ -354,9 +281,7 @@ Accessible but read-only
Pose Bones
----------
``bpy.context.object.pose.bones`` contains pose bones.
This is where animation data resides, i.e. animatable transformations
are applied to pose bones, as are constraints and ik-settings.
``bpy.context.object.pose.bones`` contains pose bones. This is where animation data resides, i.e. animatable transformations are applied to pose bones, as are constraints and ik-settings.
Examples using :class:`bpy.types.PoseBone` in object or pose mode:
@@ -371,27 +296,19 @@ Examples using :class:`bpy.types.PoseBone` in object or pose mode:
.. note::
Notice the pose is accessed from the object rather than the object data,
this is why blender can have 2 or more objects sharing the same armature in different poses.
Notice the pose is accessed from the object rather than the object data, this is why blender can have 2 or more objects sharing the same armature in different poses.
.. note::
Strictly speaking PoseBone's are not bones, they are just the state of the armature,
stored in the :class:`bpy.types.Object` rather than the :class:`bpy.types.Armature`,
the real bones are however accessible from the pose bones - :class:`bpy.types.PoseBone.bone`
Strictly speaking PoseBone's are not bones, they are just the state of the armature, stored in the :class:`bpy.types.Object` rather than the :class:`bpy.types.Armature`, the real bones are however accessible from the pose bones - :class:`bpy.types.PoseBone.bone`
Armature Mode Switching
-----------------------
While writing scripts that deal with armatures you may find you have to switch between modes,
when doing so take care when switching out of edit-mode not to keep references
to the edit-bones or their head/tail vectors.
Further access to these will crash blender so its important the script
clearly separates sections of the code which operate in different modes.
While writing scripts that deal with armatures you may find you have to switch between modes, when doing so take care when switching out of editmode not to keep references to the edit-bones or their head/tail vectors. Further access to these will crash blender so its important the script clearly separates sections of the code which operate in different modes.
This is mainly an issue with editmode since pose data can be manipulated without having to be in pose mode,
however for operator access you may still need to enter pose mode.
This is mainly an issue with editmode since pose data can be manipulated without having to be in pose mode, however for operator access you may still need to enter pose mode.
Data Names
@@ -426,13 +343,10 @@ Or with name assignment...
Data names may not match the assigned values if they exceed the maximum length, are already used or an empty string.
Its better practice not to reference objects by names at all,
once created you can store the data in a list, dictionary, on a class etc,
there is rarely a reason to have to keep searching for the same data by name.
Its better practice not to reference objects by names at all, once created you can store the data in a list, dictionary, on a class etc, there is rarely a reason to have to keep searching for the same data by name.
If you do need to use name references, its best to use a dictionary to maintain
a mapping between the names of the imported assets and the newly created data,
this way you don't run this risk of referencing existing data from the blend file, or worse modifying it.
If you do need to use name references, its best to use a dictionary to maintain a mapping between the names of the imported assets and the newly created data, this way you don't run this risk of referencing existing data from the blend file, or worse modifying it.
.. code-block:: python
@@ -444,22 +358,18 @@ this way you don't run this risk of referencing existing data from the blend fil
# normally some code, or function calls...
# use own dictionary rather than bpy.data
# use own dictionary rather then bpy.data
mesh = mesh_name_mapping[meshid]
Library Collisions
------------------
Blender keeps data names unique - :class:`bpy.types.ID.name` so you can't name two objects,
meshes, scenes etc the same thing by accident.
Blender keeps data names unique - :class:`bpy.types.ID.name` so you can't name two objects, meshes, scenes etc the same thing by accident.
However when linking in library data from another blend file naming collisions can occur,
so its best to avoid referencing data by name at all.
However when linking in library data from another blend file naming collisions can occur, so its best to avoid referencing data by name at all.
This can be tricky at times and not even blender handles this correctly in some case
(when selecting the modifier object for eg you can't select between multiple objects with the same name),
but its still good to try avoid problems in this area.
This can be tricky at times and not even blender handles this correctly in some case (when selecting the modifier object for eg you can't select between multiple objects with the same name), but its still good to try avoid problems in this area.
If you need to select between local and library data, there is a feature in ``bpy.data`` members to allow for this.
@@ -484,23 +394,21 @@ If you need to select between local and library data, there is a feature in ``bp
Relative File Paths
===================
Blenders relative file paths are not compatible with standard Python modules such as ``sys`` and ``os``.
Blenders relative file paths are not compatible with standard python modules such as ``sys`` and ``os``.
Built in Python functions don't understand blenders ``//`` prefix which denotes the blend file path.
Built in python functions don't understand blenders ``//`` prefix which denotes the blend file path.
A common case where you would run into this problem is when exporting a material with associated image paths.
>>> bpy.path.abspath(image.filepath)
>>> bpy.path.abspath(image.filepath)
When using blender data from linked libraries there is an unfortunate complication
since the path will be relative to the library rather than the open blend file.
When the data block may be from an external blend file pass the library argument from the :class:`bpy.types.ID`.
When using blender data from linked libraries there is an unfortunate complication since the path will be relative to the library rather then the open blend file. When the data block may be from an external blend file pass the library argument from the :class:`bpy.types.ID`.
>>> bpy.path.abspath(image.filepath, library=image.library)
>>> bpy.path.abspath(image.filepath, library=image.library)
These returns the absolute path which can be used with native Python modules.
These returns the absolute path which can be used with native python modules.
Unicode Problems
@@ -541,28 +449,23 @@ Here are 2 ways around filesystem encoding issues:
>>> bpy.context.object.name = filepath_utf8
Unicode encoding/decoding is a big topic with comprehensive Python documentation,
to avoid getting stuck too deep in encoding problems - here are some suggestions:
Unicode encoding/decoding is a big topic with comprehensive python documentation, to avoid getting stuck too deep in encoding problems - here are some suggestions:
- Always use utf-8 encoding or convert to utf-8 where the input is unknown.
- Avoid manipulating filepaths as strings directly, use ``os.path`` functions instead.
- Use ``os.fsencode()`` / ``os.fsdecode()`` instead of built in string decoding functions when operating on paths.
- To print paths or to include them in the user interface use ``repr(path)`` first
or ``"%r" % path`` with string formatting.
* Always use utf-8 encoiding or convert to utf-8 where the input is unknown.
.. note::
* Avoid manipulating filepaths as strings directly, use ``os.path`` functions instead.
Sometimes it's preferrable to avoid string encoding issues by using bytes instead of Python strings,
when reading some input its less trouble to read it as binary data
though you will still need to decide how to treat any strings you want to use with Blender,
some importers do this.
* Use ``os.fsencode()`` / ``os.fsdecode()`` rather then the built in string decoding functions when operating on paths.
* To print paths or to include them in the user interface use ``repr(path)`` first or ``"%r" % path`` with string formatting.
* **Possibly** - use bytes instead of python strings, when reading some input its less trouble to read it as binary data though you will still need to decide how to treat any strings you want to use with Blender, some importers do this.
Strange errors using 'threading' module
=======================================
Python threading with Blender only works properly when the threads finish up before the script does.
By using ``threading.join()`` for example.
Python threading with Blender only works properly when the threads finish up before the script does. By using ``threading.join()`` for example.
Heres an example of threading supported by Blender:
@@ -601,8 +504,7 @@ Heres an example of threading supported by Blender:
t.join()
This an example of a timer which runs many times a second and moves
the default cube continuously while Blender runs **(Unsupported)**.
This an example of a timer which runs many times a second and moves the default cube continuously while Blender runs **(Unsupported)**.
.. code-block:: python
@@ -619,48 +521,38 @@ the default cube continuously while Blender runs **(Unsupported)**.
my_timer()
Use cases like the one above which leave the thread running once the script finishes
may seem to work for a while but end up causing random crashes or errors in Blender's own drawing code.
Use cases like the one above which leave the thread running once the script finishes may seem to work for a while but end up causing random crashes or errors in Blender's own drawing code.
So far, no work has gone into making Blender's Python integration thread safe,
so until its properly supported, best not make use of this.
So far, no work has gone into making Blender's python integration thread safe, so until its properly supported, best not make use of this.
.. note::
Pythons threads only allow co-currency and won't speed up your scripts on multi-processor systems,
the ``subprocess`` and ``multiprocess`` modules can be used with Blender and make use of multiple CPU's too.
Pythons threads only allow co-currency and won't speed up your scripts on multi-processor systems, the ``subprocess`` and ``multiprocess`` modules can be used with Blender and make use of multiple CPU's too.
Help! My script crashes Blender
===============================
Ideally it would be impossible to crash Blender from Python
however there are some problems with the API where it can be made to crash.
Ideally it would be impossible to crash Blender from python however there are some problems with the API where it can be made to crash.
Strictly speaking this is a bug in the API but fixing it would mean adding memory verification
on every access since most crashes are caused by the Python objects referencing Blenders memory directly,
whenever the memory is freed, further Python access to it can crash the script.
But fixing this would make the scripts run very slow,
or writing a very different kind of API which doesn't reference the memory directly.
Strictly speaking this is a bug in the API but fixing it would mean adding memory verification on every access since most crashes are caused by the python objects referencing Blenders memory directly, whenever the memory is freed, further python access to it can crash the script. But fixing this would make the scripts run very slow, or writing a very different kind of API which doesn't reference the memory directly.
Here are some general hints to avoid running into these problems.
- Be aware of memory limits,
especially when working with large lists since Blender can crash simply by running out of memory.
- Many hard to fix crashes end up being because of referencing freed data,
when removing data be sure not to hold any references to it.
- Modules or classes that remain active while Blender is used,
should not hold references to data the user may remove, instead,
fetch data from the context each time the script is activated.
- Crashes may not happen every time, they may happen more on some configurations/operating-systems.
* Be aware of memory limits, especially when working with large lists since Blender can crash simply by running out of memory.
* Many hard to fix crashes end up being because of referencing freed data, when removing data be sure not to hold any references to it.
* Modules or classes that remain active while Blender is used, should not hold references to data the user may remove, instead, fetch data from the context each time the script is activated.
* Crashes may not happen every time, they may happen more on some configurations/operating-systems.
.. note::
To find the line of your script that crashes you can use the ``faulthandler`` module.
See `faulthandler docs <http://docs.python.org/dev/library/faulthandler.html>`_.
While the crash may be in Blenders C/C++ code,
this can help a lot to track down the area of the script that causes the crash.
While the crash may be in Blenders C/C++ code, this can help a lot to track down the area of the script that causes the crash.
Undo/Redo
@@ -680,36 +572,28 @@ This example shows how you can tell undo changes the memory locations.
>>> hash(bpy.context.object)
-9223372036849951740
As suggested above, simply not holding references to data when Blender is used
interactively by the user is the only way to ensure the script doesn't become unstable.
As suggested above, simply not holding references to data when Blender is used interactively by the user is the only way to ensure the script doesn't become unstable.
Undo & Library Data
^^^^^^^^^^^^^^^^^^^
One of the advantages with Blenders library linking system that undo
can skip checking changes in library data since it is assumed to be static.
One of the advantages with Blenders library linking system that undo can skip checking changes in library data since it is assumed to be static.
Tools in Blender are not allowed to modify library data.
Python however does not enforce this restriction.
This can be useful in some cases, using a script to adjust material values for example.
But its also possible to use a script to make library data point to newly created local data,
which is not supported since a call to undo will remove the local data
but leave the library referencing it and likely crash.
But its also possible to use a script to make library data point to newly created local data, which is not supported since a call to undo will remove the local data but leave the library referencing it and likely crash.
So it's best to consider modifying library data an advanced usage of the API
and only to use it when you know what you're doing.
So it's best to consider modifying library data an advanced usage of the API and only to use it when you know what you're doing.
Edit Mode / Memory Access
-------------------------
Switching edit-mode ``bpy.ops.object.mode_set(mode='EDIT')`` / ``bpy.ops.object.mode_set(mode='OBJECT')``
will re-allocate objects data,
any references to a meshes vertices/polygons/uvs, armatures bones,
curves points etc cannot be accessed after switching edit-mode.
Switching edit-mode ``bpy.ops.object.mode_set(mode='EDIT')`` / ``bpy.ops.object.mode_set(mode='OBJECT')`` will re-allocate objects data, any references to a meshes vertices/polygons/uvs, armatures bones, curves points etc cannot be accessed after switching edit-mode.
Only the reference to the data its self can be re-accessed, the following example will crash.
@@ -724,8 +608,7 @@ Only the reference to the data its self can be re-accessed, the following exampl
print(polygons)
So after switching edit-mode you need to re-access any object data variables,
the following example shows how to avoid the crash above.
So after switching edit-mode you need to re-access any object data variables, the following example shows how to avoid the crash above.
.. code-block:: python
@@ -739,15 +622,13 @@ the following example shows how to avoid the crash above.
print(polygons)
These kinds of problems can happen for any functions which re-allocate
the object data but are most common when switching edit-mode.
These kinds of problems can happen for any functions which re-allocate the object data but are most common when switching edit-mode.
Array Re-Allocation
-------------------
When adding new points to a curve or vertices's/edges/polygons to a mesh,
internally the array which stores this data is re-allocated.
When adding new points to a curve or vertices's/edges/polygons to a mesh, internally the array which stores this data is re-allocated.
.. code-block:: python
@@ -758,20 +639,15 @@ internally the array which stores this data is re-allocated.
# this will crash!
point.co = 1.0, 2.0, 3.0
This can be avoided by re-assigning the point variables after adding the new one or by storing
indices's to the points rather than the points themselves.
This can be avoided by re-assigning the point variables after adding the new one or by storing indices's to the points rather then the points themselves.
The best way is to sidestep the problem altogether add all the points to the curve at once.
This means you don't have to worry about array re-allocation and its faster too
since reallocating the entire array for every point added is inefficient.
The best way is to sidestep the problem altogether add all the points to the curve at once. This means you don't have to worry about array re-allocation and its faster too since reallocating the entire array for every point added is inefficient.
Removing Data
-------------
**Any** data that you remove shouldn't be modified or accessed afterwards,
this includes f-curves, drivers, render layers, timeline markers, modifiers, constraints
along with objects, scenes, groups, bones.. etc.
**Any** data that you remove shouldn't be modified or accessed afterwards, this includes f-curves, drivers, render layers, timeline markers, modifiers, constraints along with objects, scenes, groups, bones.. etc.
The ``remove()`` api calls will invalidate the data they free to prevent common mistakes.
@@ -782,13 +658,12 @@ The following example shows how this precortion works.
mesh = bpy.data.meshes.new(name="MyMesh")
# normally the script would use the mesh here...
bpy.data.meshes.remove(mesh)
print(mesh.name) # <- give an exception rather than crashing:
print(mesh.name) # <- give an exception rather then crashing:
# ReferenceError: StructRNA of type Mesh has been removed
But take care because this is limited to scripts accessing the variable which is removed,
the next example will still crash.
But take care because this is limited to scripts accessing the variable which is removed, the next example will still crash.
.. code-block:: python
@@ -801,11 +676,9 @@ the next example will still crash.
sys.exit
========
Some Python modules will call ``sys.exit()`` themselves when an error occurs,
while not common behavior this is something to watch out for because it may seem
as if Blender is crashing since ``sys.exit()`` will close Blender immediately.
Some python modules will call ``sys.exit()`` themselves when an error occurs, while not common behavior this is something to watch out for because it may seem as if blender is crashing since ``sys.exit()`` will quit blender immediately.
For example, the ``argparse`` module will print an error and exit if the arguments are invalid.
For example, the ``optparse`` module will print an error and exit if the arguments are invalid.
An ugly way of troubleshooting this is to set ``sys.exit = None`` and see what line of python code is quitting, you could of course replace ``sys.exit`` with your own function but manipulating python in this way is bad practice.
An ugly way of troubleshooting this is to set ``sys.exit = None`` and see what line of Python code is quitting,
you could of course replace ``sys.exit`` with your own function but manipulating Python in this way is bad practice.

View File

@@ -59,7 +59,7 @@ text editor or entering commands in the Python console.
Both the *Text Editor* and *Python Console* are space types you can select from the view header.
Rather than manually configuring your spaces for Python development,
Rather then manually configuring your spaces for Python development,
you may prefer to use the *Scripting* screen, included default with Blender,
accessible from the top headers screen selector.

View File

@@ -81,7 +81,7 @@ Editing a text file externally and having the same text open in Blender does wor
so here are 2 ways you can easily use an external file from Blender.
Using the following examples you'll still need textblock in Blender to execute,
but reference an external file rather than including it directly.
but reference an external file rather then including it directly.
Executing External Scripts
@@ -306,7 +306,7 @@ Python Safety (Build Option)
Since it's possible to access data which has been removed (see Gotcha's),
this can be hard to track down the cause of crashes.
To raise Python exceptions on accessing freed data (rather than crashing),
To raise Python exceptions on accessing freed data (rather then crashing),
enable the CMake build option WITH_PYTHON_SAFETY.
This enables data tracking which makes data access about 2x slower

View File

@@ -263,7 +263,6 @@ else:
"gpu",
"mathutils",
"mathutils.geometry",
"mathutils.bvhtree",
"mathutils.kdtree",
"mathutils.noise",
"freestyle",
@@ -632,7 +631,7 @@ def pyfunc2sphinx(ident, fw, module_name, type_name, identifier, py_func, is_cla
if type(py_func) == MethodType:
return
arg_str = inspect.formatargspec(*inspect.getfullargspec(py_func))
arg_str = inspect.formatargspec(*inspect.getargspec(py_func))
if not is_class:
func_type = "function"
@@ -1600,7 +1599,7 @@ def write_rst_contents(basepath):
fw("\n")
# fw("`A PDF version of this document is also available <%s>`_\n" % BLENDER_PDF_FILENAME)
fw("This site can be downloaded for offline use `Download the full Documentation (zipped HTML files)<%s>`_\n" % BLENDER_ZIP_FILENAME)
fw("`A compressed ZIP file of this site is available <%s>`_\n" % BLENDER_ZIP_FILENAME)
fw("\n")
@@ -1645,7 +1644,7 @@ def write_rst_contents(basepath):
standalone_modules = (
# mathutils
"mathutils", "mathutils.geometry", "mathutils.bvhtree", "mathutils.kdtree", "mathutils.noise",
"mathutils", "mathutils.geometry", "mathutils.kdtree", "mathutils.noise",
# misc
"freestyle", "bgl", "blf", "gpu", "aud", "bpy_extras",
# bmesh, submodules are in own page
@@ -1797,7 +1796,6 @@ def write_rst_importable_modules(basepath):
"bpy.props" : "Property Definitions",
"mathutils" : "Math Types & Utilities",
"mathutils.geometry" : "Geometry Utilities",
"mathutils.bvhtree" : "BVHTree Utilities",
"mathutils.kdtree" : "KDTree Utilities",
"mathutils.noise" : "Noise Utilities",
"freestyle" : "Freestyle Module",

View File

@@ -29,7 +29,6 @@ remove_strict_flags()
add_subdirectory(rangetree)
add_subdirectory(wcwidth)
add_subdirectory(libmv)
add_subdirectory(Eigen3)
if(WITH_OPENNL)
add_subdirectory(colamd)
@@ -78,7 +77,7 @@ if(WITH_LZMA)
add_subdirectory(lzma)
endif()
if(WITH_CYCLES OR WITH_COMPOSITOR OR WITH_OPENSUBDIV)
if(WITH_CYCLES OR WITH_COMPOSITOR)
add_subdirectory(clew)
add_subdirectory(cuew)
endif()

View File

@@ -1,41 +0,0 @@
# ***** BEGIN GPL LICENSE BLOCK *****
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software Foundation,
# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#
# The Original Code is Copyright (C) 2015, Blender Foundation
# All rights reserved.
#
# The Original Code is: all of this file.
#
# Contributor(s): Bastien Montagne.
#
# ***** END GPL LICENSE BLOCK *****
set(INC
.
)
set(INC_SYS
)
set(SRC
eigen3_capi.h
intern/eigenvalues.cc
intern/eigenvalues.h
)
blender_add_lib(extern_eigen3 "${SRC}" "${INC}" "${INC_SYS}")

View File

@@ -1,35 +0,0 @@
#!/usr/bin/env python
#
# ***** BEGIN GPL LICENSE BLOCK *****
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software Foundation,
# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#
# The Original Code is Copyright (C) 2015, Blender Foundation
# All rights reserved.
#
# The Original Code is: all of this file.
#
# Contributor(s): Bastien Montagne.
#
# ***** END GPL LICENSE BLOCK *****
Import('env')
sources = env.Glob('intern/*.cc')
incs = '.'
defs = []
env.BlenderLib('extern_eigen3', sources, Split(incs), defs, libtype=['extern','player'], priority=[10, 185])

View File

@@ -1,32 +0,0 @@
/*
* ***** BEGIN GPL LICENSE BLOCK *****
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
* The Original Code is Copyright (C) 2015 Blender Foundation.
* All rights reserved.
*
* Contributor(s): Blender Foundation,
* Bastien Montagne
*
* ***** END GPL LICENSE BLOCK *****
*/
#ifndef __EIGEN3_C_API_H__
#define __EIGEN3_C_API_H__
#include "intern/eigenvalues.h"
#endif /* __EIGEN3_C_API_H__ */

View File

@@ -1,70 +0,0 @@
/*
* ***** BEGIN GPL LICENSE BLOCK *****
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
* The Original Code is Copyright (C) 2015 Blender Foundation.
* All rights reserved.
*
* Contributor(s): Blender Foundation,
* Bastien Montagne
*
* ***** END GPL LICENSE BLOCK *****
*/
#ifndef __EIGEN3_EIGENVALUES_C_API_CC__
#define __EIGEN3_EIGENVALUES_C_API_CC__
/* Eigen gives annoying huge amount of warnings here, silence them! */
#ifdef __GNUC__
# pragma GCC diagnostic ignored "-Wlogical-op"
#endif
#include <Eigen/Core>
#include <Eigen/Eigenvalues>
#include "eigenvalues.h"
using Eigen::SelfAdjointEigenSolver;
using Eigen::MatrixXf;
using Eigen::VectorXf;
using Eigen::Map;
using Eigen::Success;
bool EG3_self_adjoint_eigen_solve(const int size, const float *matrix, float *r_eigen_values, float *r_eigen_vectors)
{
SelfAdjointEigenSolver<MatrixXf> eigen_solver;
/* Blender and Eigen matrices are both column-major. */
eigen_solver.compute(Map<MatrixXf>((float *)matrix, size, size));
if (eigen_solver.info() != Success) {
return false;
}
if (r_eigen_values) {
Map<VectorXf>(r_eigen_values, size) = eigen_solver.eigenvalues().transpose();
}
if (r_eigen_vectors) {
Map<MatrixXf>(r_eigen_vectors, size, size) = eigen_solver.eigenvectors();
}
return true;
}
#endif /* __EIGEN3_EIGENVALUES_C_API_CC__ */

View File

@@ -1,40 +0,0 @@
/*
* ***** BEGIN GPL LICENSE BLOCK *****
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
* The Original Code is Copyright (C) 2015 Blender Foundation.
* All rights reserved.
*
* Contributor(s): Blender Foundation,
* Bastien Montagne
*
* ***** END GPL LICENSE BLOCK *****
*/
#ifndef __EIGEN3_EIGENVALUES_C_API_H__
#define __EIGEN3_EIGENVALUES_C_API_H__
#ifdef __cplusplus
extern "C" {
#endif
bool EG3_self_adjoint_eigen_solve(const int size, const float *matrix, float *r_eigen_values, float *r_eigen_vectors);
#ifdef __cplusplus
}
#endif
#endif /* __EIGEN3_EIGENVALUES_C_API_H__ */

3
extern/SConscript vendored
View File

@@ -11,7 +11,6 @@ SConscript(['colamd/SConscript'])
SConscript(['rangetree/SConscript'])
SConscript(['wcwidth/SConscript'])
SConscript(['libmv/SConscript'])
SConscript(['Eigen3/SConscript'])
if env['WITH_BF_GAMEENGINE']:
SConscript(['recastnavigation/SConscript'])
@@ -25,7 +24,7 @@ if env['WITH_BF_ELTOPO']:
if env['WITH_BF_BULLET']:
SConscript(['bullet2/src/SConscript'])
if env['WITH_BF_COMPOSITOR'] or env['WITH_BF_CYCLES'] or env['WITH_BF_OPENSUBDIV']:
if env['WITH_BF_COMPOSITOR'] or env['WITH_BF_CYCLES']:
SConscript (['clew/SConscript'])
SConscript (['cuew/SConscript'])

View File

@@ -6,9 +6,7 @@ Import('env')
sources = ['src/glew.c']
defs = []
defs += env['BF_GL_DEFINITIONS']
defs = env['BF_GL_DEFINITIONS']
if env['WITH_BF_GLEW_MX']:
defs += ['GLEW_MX']
incs = ['include']

View File

@@ -6,9 +6,7 @@ Import('env')
sources = ['src/glew.c']
defs = []
defs += env['BF_GL_DEFINITIONS']
defs = env['BF_GL_DEFINITIONS']
if env['WITH_BF_GLEW_MX']:
defs += ['GLEW_MX']

View File

@@ -77,11 +77,8 @@ if(WITH_OPENNL)
add_subdirectory(opennl)
endif()
if(WITH_OPENSUBDIV)
add_subdirectory(opensubdiv)
endif()
# only windows needs utf16 converter
if(WIN32)
add_subdirectory(utfconv)
endif()

View File

@@ -27,7 +27,8 @@
Import ('env')
SConscript(['string/SConscript',
SConscript(['audaspace/SConscript',
'string/SConscript',
'ghost/SConscript',
'glew-mx/SConscript',
'guardedalloc/SConscript',
@@ -44,9 +45,6 @@ SConscript(['string/SConscript',
# currently only contains headers
# SConscript('container/SConscript')
if env['WITH_BF_AUDASPACE']:
SConscript(['audaspace/SConscript'])
if env ['WITH_BF_REMESH']:
SConscript(['dualcon/SConscript'])
@@ -65,5 +63,3 @@ if env['WITH_BF_BULLET']:
if env['OURPLATFORM'] in ('win32-vc', 'win32-mingw', 'win64-mingw', 'linuxcross', 'win64-vc'):
SConscript(['utfconv/SConscript'])
if env['WITH_BF_OPENSUBDIV']:
SConscript (['opensubdiv/SConscript'])

View File

@@ -123,13 +123,13 @@ atomic_cas_uint64(uint64_t *v, uint64_t old, uint64_t _new)
ATOMIC_INLINE uint64_t
atomic_add_uint64(uint64_t *p, uint64_t x)
{
return InterlockedExchangeAdd64((int64_t *)p, (int64_t)x) + x;
return InterlockedExchangeAdd64((int64_t *)p, (int64_t)x);
}
ATOMIC_INLINE uint64_t
atomic_sub_uint64(uint64_t *p, uint64_t x)
{
return InterlockedExchangeAdd64((int64_t *)p, -((int64_t)x)) - x;
return InterlockedExchangeAdd64((int64_t *)p, -((int64_t)x));
}
ATOMIC_INLINE uint64_t
@@ -215,7 +215,7 @@ atomic_sub_uint64(uint64_t *p, uint64_t x)
}
ATOMIC_INLINE uint64_t
atomic_cas_uint64(uint64_t *v, uint64_t old, uint64_t _new)
atomic_cas_uint32(uint64_t *v, uint64_t old, uint64_t _new)
{
assert(sizeof(uint64_t) == sizeof(unsigned long));
@@ -235,7 +235,7 @@ atomic_sub_uint64(uint64_t *p, uint64_t x)
}
ATOMIC_INLINE uint64_t
atomic_cas_uint64(uint64_t *v, uint64_t old, uint64_t _new)
atomic_cas_uint32(uint64_t *v, uint64_t old, uint64_t _new)
{
return __sync_val_compare_and_swap(v, old, _new);
}
@@ -268,13 +268,13 @@ atomic_cas_uint32(uint32_t *v, uint32_t old, uint32_t _new)
ATOMIC_INLINE uint32_t
atomic_add_uint32(uint32_t *p, uint32_t x)
{
return InterlockedExchangeAdd(p, x) + x;
return InterlockedExchangeAdd(p, x);
}
ATOMIC_INLINE uint32_t
atomic_sub_uint32(uint32_t *p, uint32_t x)
{
return InterlockedExchangeAdd(p, -((int32_t)x)) - x;
return InterlockedExchangeAdd(p, -((int32_t)x));
}
ATOMIC_INLINE uint32_t

View File

@@ -21,35 +21,6 @@
remove_extra_strict_flags()
if(WITH_SYSTEM_AUDASPACE)
set(INC
.
)
set(INC_SYS
${AUDASPACE_C_INCLUDE_DIRS}
${AUDASPACE_PY_INCLUDE_DIRS}
)
set(SRC
intern/AUD_Set.cpp
intern/AUD_Set.h
)
if(WITH_PYTHON)
list(APPEND INC_SYS
${PYTHON_INCLUDE_DIRS}
)
list(APPEND SRC
intern/AUD_PyInit.cpp
intern/AUD_PyInit.h
)
add_definitions(-DWITH_PYTHON)
endif()
else()
set(INC
.
FX
@@ -345,6 +316,5 @@ if(WITH_PYTHON)
)
add_definitions(-DWITH_PYTHON)
endif()
endif()
blender_add_lib(bf_intern_audaspace "${SRC}" "${INC}" "${INC_SYS}")

View File

@@ -21,15 +21,9 @@
#
# ***** END LGPL LICENSE BLOCK *****
from os import path
Import ('env')
sources = env.Glob('intern/*.cpp') + env.Glob('FX/*.cpp')
# AUD_PyInit is for external audaspace only
sources.remove(path.join('intern', 'AUD_PyInit.cpp'))
incs = '. intern FX ' + env['BF_PTHREADS_INC'] + ' ' + env['BF_BOOST_INC']
defs = []

View File

@@ -99,7 +99,7 @@ extern "C" {
#include <cassert>
typedef boost::shared_ptr<AUD_IFactory> AUD_Sound;
typedef boost::shared_ptr<AUD_IDevice> AUD_Device;
typedef boost::shared_ptr<AUD_ReadDevice> AUD_Device;
typedef boost::shared_ptr<AUD_IHandle> AUD_Handle;
typedef boost::shared_ptr<AUD_SequencerEntry> AUD_SEntry;
@@ -130,69 +130,70 @@ void AUD_exitOnce()
#endif
}
AUD_Device* AUD_init(const char* device, AUD_DeviceSpecs specs, int buffersize, const char* name)
int AUD_init(AUD_DeviceType device, AUD_DeviceSpecs specs, int buffersize)
{
boost::shared_ptr<AUD_IDevice> dev;
if (AUD_device.get()) {
AUD_exit(NULL);
AUD_exit();
}
std::string dname = device;
try {
if(dname == "Null") {
switch(device) {
case AUD_NULL_DEVICE:
dev = boost::shared_ptr<AUD_IDevice>(new AUD_NULLDevice());
}
break;
#ifdef WITH_SDL
else if(dname == "SDL")
{
dev = boost::shared_ptr<AUD_IDevice>(new AUD_SDLDevice(specs, buffersize));
}
case AUD_SDL_DEVICE:
if (SDL_Init == (void *)0) {
printf("Warning: SDL libraries are not installed\n");
// No break, fall through to default, to return false
}
else {
dev = boost::shared_ptr<AUD_IDevice>(new AUD_SDLDevice(specs, buffersize));
break;
}
#endif
#ifdef WITH_OPENAL
else if(dname == "OpenAL")
{
case AUD_OPENAL_DEVICE:
dev = boost::shared_ptr<AUD_IDevice>(new AUD_OpenALDevice(specs, buffersize));
}
break;
#endif
#ifdef WITH_JACK
else if(dname == "Jack")
{
case AUD_JACK_DEVICE:
#ifdef __APPLE__
struct stat st;
if (stat("/Library/Frameworks/Jackmp.framework", &st) != 0) {
printf("Warning: Jack Framework not installed\n");
return NULL;
// No break, fall through to default, to return false
}
else
#endif
if (!AUD_jack_supported()) {
printf("Warning: Jack cllient not installed\n");
return NULL;
printf("Warning: Jack client not installed\n");
// No break, fall through to default, to return false
}
else {
dev = boost::shared_ptr<AUD_IDevice>(new AUD_JackDevice(name, specs, buffersize));
dev = boost::shared_ptr<AUD_IDevice>(new AUD_JackDevice("Blender", specs, buffersize));
break;
}
}
#endif
else
{
return NULL;
default:
return false;
}
AUD_device = dev;
AUD_3ddevice = dynamic_cast<AUD_I3DDevice *>(AUD_device.get());
return (AUD_Device*)1;
return true;
}
catch(AUD_Exception&)
{
return NULL;
return false;
}
}
void AUD_exit(AUD_Device* device)
void AUD_exit()
{
AUD_device = boost::shared_ptr<AUD_IDevice>();
AUD_3ddevice = NULL;
@@ -265,7 +266,7 @@ PyObject *AUD_initPython()
return module;
}
void *AUD_getPythonSound(AUD_Sound *sound)
void *AUD_getPythonFactory(AUD_Sound *sound)
{
if (sound) {
Factory *obj = (Factory *) Factory_empty();
@@ -278,7 +279,7 @@ void *AUD_getPythonSound(AUD_Sound *sound)
return NULL;
}
AUD_Sound *AUD_getSoundFromPython(void *sound)
AUD_Sound *AUD_getPythonSound(void *sound)
{
Factory *factory = checkFactory((PyObject *)sound);
@@ -290,26 +291,16 @@ AUD_Sound *AUD_getSoundFromPython(void *sound)
#endif
void AUD_Device_lock(AUD_Device* device)
void AUD_lock()
{
AUD_device->lock();
}
void AUD_Device_unlock(AUD_Device* device)
void AUD_unlock()
{
AUD_device->unlock();
}
AUD_Channels AUD_Device_getChannels(AUD_Device* device)
{
return AUD_device->getSpecs().channels;
}
AUD_SampleRate AUD_Device_getRate(AUD_Device* device)
{
return AUD_device->getSpecs().rate;
}
AUD_SoundInfo AUD_getInfo(AUD_Sound *sound)
{
assert(sound);
@@ -335,19 +326,19 @@ AUD_SoundInfo AUD_getInfo(AUD_Sound *sound)
return info;
}
AUD_Sound *AUD_Sound_file(const char *filename)
AUD_Sound *AUD_load(const char *filename)
{
assert(filename);
return new AUD_Sound(new AUD_FileFactory(filename));
}
AUD_Sound *AUD_Sound_bufferFile(unsigned char *buffer, int size)
AUD_Sound *AUD_loadBuffer(unsigned char *buffer, int size)
{
assert(buffer);
return new AUD_Sound(new AUD_FileFactory(buffer, size));
}
AUD_Sound *AUD_Sound_cache(AUD_Sound *sound)
AUD_Sound *AUD_bufferSound(AUD_Sound *sound)
{
assert(sound);
@@ -360,13 +351,13 @@ AUD_Sound *AUD_Sound_cache(AUD_Sound *sound)
}
}
AUD_Sound *AUD_Sound_rechannel(AUD_Sound *sound, AUD_Channels channels)
AUD_Sound *AUD_monoSound(AUD_Sound *sound)
{
assert(sound);
try {
AUD_DeviceSpecs specs;
specs.channels = channels;
specs.channels = AUD_CHANNELS_MONO;
specs.rate = AUD_RATE_INVALID;
specs.format = AUD_FORMAT_INVALID;
return new AUD_Sound(new AUD_ChannelMapperFactory(*sound, specs));
@@ -377,7 +368,7 @@ AUD_Sound *AUD_Sound_rechannel(AUD_Sound *sound, AUD_Channels channels)
}
}
AUD_Sound *AUD_Sound_delay(AUD_Sound *sound, float delay)
AUD_Sound *AUD_delaySound(AUD_Sound *sound, float delay)
{
assert(sound);
@@ -390,7 +381,7 @@ AUD_Sound *AUD_Sound_delay(AUD_Sound *sound, float delay)
}
}
AUD_Sound *AUD_Sound_limit(AUD_Sound *sound, float start, float end)
AUD_Sound *AUD_limitSound(AUD_Sound *sound, float start, float end)
{
assert(sound);
@@ -403,7 +394,7 @@ AUD_Sound *AUD_Sound_limit(AUD_Sound *sound, float start, float end)
}
}
AUD_Sound *AUD_Sound_pingpong(AUD_Sound *sound)
AUD_Sound *AUD_pingpongSound(AUD_Sound *sound)
{
assert(sound);
@@ -416,7 +407,7 @@ AUD_Sound *AUD_Sound_pingpong(AUD_Sound *sound)
}
}
AUD_Sound *AUD_Sound_loop(AUD_Sound *sound)
AUD_Sound *AUD_loopSound(AUD_Sound *sound)
{
assert(sound);
@@ -429,7 +420,7 @@ AUD_Sound *AUD_Sound_loop(AUD_Sound *sound)
}
}
int AUD_Handle_setLoopCount(AUD_Handle *handle, int loops)
int AUD_setLoop(AUD_Handle *handle, int loops)
{
assert(handle);
@@ -456,13 +447,13 @@ AUD_Sound *AUD_rectifySound(AUD_Sound *sound)
}
}
void AUD_Sound_free(AUD_Sound *sound)
void AUD_unload(AUD_Sound *sound)
{
assert(sound);
delete sound;
}
AUD_Handle *AUD_Device_play(AUD_Device* device, AUD_Sound *sound, int keep)
AUD_Handle *AUD_play(AUD_Sound *sound, int keep)
{
assert(sound);
try {
@@ -477,19 +468,19 @@ AUD_Handle *AUD_Device_play(AUD_Device* device, AUD_Sound *sound, int keep)
return NULL;
}
int AUD_Handle_pause(AUD_Handle *handle)
int AUD_pause(AUD_Handle *handle)
{
assert(handle);
return (*handle)->pause();
}
int AUD_Handle_resume(AUD_Handle *handle)
int AUD_resume(AUD_Handle *handle)
{
assert(handle);
return (*handle)->resume();
}
int AUD_Handle_stop(AUD_Handle *handle)
int AUD_stop(AUD_Handle *handle)
{
assert(handle);
int result = (*handle)->stop();
@@ -497,36 +488,31 @@ int AUD_Handle_stop(AUD_Handle *handle)
return result;
}
void AUD_Device_stopAll(void* device)
{
AUD_device->stopAll();
}
int AUD_Handle_setKeep(AUD_Handle *handle, int keep)
int AUD_setKeep(AUD_Handle *handle, int keep)
{
assert(handle);
return (*handle)->setKeep(keep);
}
int AUD_Handle_setPosition(AUD_Handle *handle, float seekTo)
int AUD_seek(AUD_Handle *handle, float seekTo)
{
assert(handle);
return (*handle)->seek(seekTo);
}
float AUD_Handle_getPosition(AUD_Handle *handle)
float AUD_getPosition(AUD_Handle *handle)
{
assert(handle);
return (*handle)->getPosition();
}
AUD_Status AUD_Handle_getStatus(AUD_Handle *handle)
AUD_Status AUD_getStatus(AUD_Handle *handle)
{
assert(handle);
return (*handle)->getStatus();
}
int AUD_Device_setListenerLocation(const float location[3])
int AUD_setListenerLocation(const float location[3])
{
if (AUD_3ddevice) {
AUD_Vector3 v(location[0], location[1], location[2]);
@@ -537,7 +523,7 @@ int AUD_Device_setListenerLocation(const float location[3])
return false;
}
int AUD_Device_setListenerVelocity(const float velocity[3])
int AUD_setListenerVelocity(const float velocity[3])
{
if (AUD_3ddevice) {
AUD_Vector3 v(velocity[0], velocity[1], velocity[2]);
@@ -548,7 +534,7 @@ int AUD_Device_setListenerVelocity(const float velocity[3])
return false;
}
int AUD_Device_setListenerOrientation(const float orientation[4])
int AUD_setListenerOrientation(const float orientation[4])
{
if (AUD_3ddevice) {
AUD_Quaternion q(orientation[3], orientation[0], orientation[1], orientation[2]);
@@ -559,7 +545,7 @@ int AUD_Device_setListenerOrientation(const float orientation[4])
return false;
}
int AUD_Device_setSpeedOfSound(void* device, float speed)
int AUD_setSpeedOfSound(float speed)
{
if (AUD_3ddevice) {
AUD_3ddevice->setSpeedOfSound(speed);
@@ -569,7 +555,7 @@ int AUD_Device_setSpeedOfSound(void* device, float speed)
return false;
}
int AUD_Device_setDopplerFactor(void* device, float factor)
int AUD_setDopplerFactor(float factor)
{
if (AUD_3ddevice) {
AUD_3ddevice->setDopplerFactor(factor);
@@ -579,7 +565,7 @@ int AUD_Device_setDopplerFactor(void* device, float factor)
return false;
}
int AUD_Device_setDistanceModel(void* device, AUD_DistanceModel model)
int AUD_setDistanceModel(AUD_DistanceModel model)
{
if (AUD_3ddevice) {
AUD_3ddevice->setDistanceModel(model);
@@ -589,7 +575,7 @@ int AUD_Device_setDistanceModel(void* device, AUD_DistanceModel model)
return false;
}
int AUD_Handle_setLocation(AUD_Handle *handle, const float location[3])
int AUD_setSourceLocation(AUD_Handle *handle, const float location[3])
{
assert(handle);
boost::shared_ptr<AUD_I3DHandle> h = boost::dynamic_pointer_cast<AUD_I3DHandle>(*handle);
@@ -602,7 +588,7 @@ int AUD_Handle_setLocation(AUD_Handle *handle, const float location[3])
return false;
}
int AUD_Handle_setVelocity(AUD_Handle *handle, const float velocity[3])
int AUD_setSourceVelocity(AUD_Handle *handle, const float velocity[3])
{
assert(handle);
boost::shared_ptr<AUD_I3DHandle> h = boost::dynamic_pointer_cast<AUD_I3DHandle>(*handle);
@@ -615,7 +601,7 @@ int AUD_Handle_setVelocity(AUD_Handle *handle, const float velocity[3])
return false;
}
int AUD_Handle_setOrientation(AUD_Handle *handle, const float orientation[4])
int AUD_setSourceOrientation(AUD_Handle *handle, const float orientation[4])
{
assert(handle);
boost::shared_ptr<AUD_I3DHandle> h = boost::dynamic_pointer_cast<AUD_I3DHandle>(*handle);
@@ -628,7 +614,7 @@ int AUD_Handle_setOrientation(AUD_Handle *handle, const float orientation[4])
return false;
}
int AUD_Handle_setRelative(AUD_Handle *handle, int relative)
int AUD_setRelative(AUD_Handle *handle, int relative)
{
assert(handle);
boost::shared_ptr<AUD_I3DHandle> h = boost::dynamic_pointer_cast<AUD_I3DHandle>(*handle);
@@ -640,7 +626,7 @@ int AUD_Handle_setRelative(AUD_Handle *handle, int relative)
return false;
}
int AUD_Handle_setVolumeMaximum(AUD_Handle *handle, float volume)
int AUD_setVolumeMaximum(AUD_Handle *handle, float volume)
{
assert(handle);
boost::shared_ptr<AUD_I3DHandle> h = boost::dynamic_pointer_cast<AUD_I3DHandle>(*handle);
@@ -652,7 +638,7 @@ int AUD_Handle_setVolumeMaximum(AUD_Handle *handle, float volume)
return false;
}
int AUD_Handle_setVolumeMinimum(AUD_Handle *handle, float volume)
int AUD_setVolumeMinimum(AUD_Handle *handle, float volume)
{
assert(handle);
boost::shared_ptr<AUD_I3DHandle> h = boost::dynamic_pointer_cast<AUD_I3DHandle>(*handle);
@@ -664,7 +650,7 @@ int AUD_Handle_setVolumeMinimum(AUD_Handle *handle, float volume)
return false;
}
int AUD_Handle_setDistanceMaximum(AUD_Handle *handle, float distance)
int AUD_setDistanceMaximum(AUD_Handle *handle, float distance)
{
assert(handle);
boost::shared_ptr<AUD_I3DHandle> h = boost::dynamic_pointer_cast<AUD_I3DHandle>(*handle);
@@ -676,7 +662,7 @@ int AUD_Handle_setDistanceMaximum(AUD_Handle *handle, float distance)
return false;
}
int AUD_Handle_setDistanceReference(AUD_Handle *handle, float distance)
int AUD_setDistanceReference(AUD_Handle *handle, float distance)
{
assert(handle);
boost::shared_ptr<AUD_I3DHandle> h = boost::dynamic_pointer_cast<AUD_I3DHandle>(*handle);
@@ -688,7 +674,7 @@ int AUD_Handle_setDistanceReference(AUD_Handle *handle, float distance)
return false;
}
int AUD_Handle_setAttenuation(AUD_Handle *handle, float factor)
int AUD_setAttenuation(AUD_Handle *handle, float factor)
{
assert(handle);
boost::shared_ptr<AUD_I3DHandle> h = boost::dynamic_pointer_cast<AUD_I3DHandle>(*handle);
@@ -700,7 +686,7 @@ int AUD_Handle_setAttenuation(AUD_Handle *handle, float factor)
return false;
}
int AUD_Handle_setConeAngleOuter(AUD_Handle *handle, float angle)
int AUD_setConeAngleOuter(AUD_Handle *handle, float angle)
{
assert(handle);
boost::shared_ptr<AUD_I3DHandle> h = boost::dynamic_pointer_cast<AUD_I3DHandle>(*handle);
@@ -712,7 +698,7 @@ int AUD_Handle_setConeAngleOuter(AUD_Handle *handle, float angle)
return false;
}
int AUD_Handle_setConeAngleInner(AUD_Handle *handle, float angle)
int AUD_setConeAngleInner(AUD_Handle *handle, float angle)
{
assert(handle);
boost::shared_ptr<AUD_I3DHandle> h = boost::dynamic_pointer_cast<AUD_I3DHandle>(*handle);
@@ -724,7 +710,7 @@ int AUD_Handle_setConeAngleInner(AUD_Handle *handle, float angle)
return false;
}
int AUD_Handle_setConeVolumeOuter(AUD_Handle *handle, float volume)
int AUD_setConeVolumeOuter(AUD_Handle *handle, float volume)
{
assert(handle);
boost::shared_ptr<AUD_I3DHandle> h = boost::dynamic_pointer_cast<AUD_I3DHandle>(*handle);
@@ -736,7 +722,7 @@ int AUD_Handle_setConeVolumeOuter(AUD_Handle *handle, float volume)
return false;
}
int AUD_Handle_setVolume(AUD_Handle *handle, float volume)
int AUD_setSoundVolume(AUD_Handle *handle, float volume)
{
assert(handle);
try {
@@ -746,7 +732,7 @@ int AUD_Handle_setVolume(AUD_Handle *handle, float volume)
return false;
}
int AUD_Handle_setPitch(AUD_Handle *handle, float pitch)
int AUD_setSoundPitch(AUD_Handle *handle, float pitch)
{
assert(handle);
try {
@@ -798,13 +784,13 @@ int AUD_setDeviceVolume(AUD_Device *device, float volume)
return false;
}
int AUD_Device_read(AUD_Device *device, data_t *buffer, int length)
int AUD_readDevice(AUD_Device *device, data_t *buffer, int length)
{
assert(device);
assert(buffer);
try {
return boost::dynamic_pointer_cast<AUD_ReadDevice>(*device)->read(buffer, length);
return (*device)->read(buffer, length);
}
catch(AUD_Exception&)
{
@@ -812,11 +798,12 @@ int AUD_Device_read(AUD_Device *device, data_t *buffer, int length)
}
}
void AUD_Device_free(AUD_Device *device)
void AUD_closeReadDevice(AUD_Device *device)
{
assert(device);
try {
if(device != &AUD_device)
delete device;
delete device;
}
catch(AUD_Exception&)
{
@@ -914,7 +901,7 @@ AUD_Handle *AUD_pauseAfter(AUD_Handle *handle, float seconds)
return NULL;
}
AUD_Sound *AUD_Sequence_create(float fps, int muted)
AUD_Sound *AUD_createSequencer(float fps, int muted)
{
// specs are changed at a later point!
AUD_Specs specs;
@@ -924,22 +911,22 @@ AUD_Sound *AUD_Sequence_create(float fps, int muted)
return sequencer;
}
void AUD_Sequence_free(AUD_Sound *sequencer)
void AUD_destroySequencer(AUD_Sound *sequencer)
{
delete sequencer;
}
void AUD_Sequence_setMuted(AUD_Sound *sequencer, int muted)
void AUD_setSequencerMuted(AUD_Sound *sequencer, int muted)
{
dynamic_cast<AUD_SequencerFactory *>(sequencer->get())->mute(muted);
}
void AUD_Sequence_setFPS(AUD_Sound *sequencer, float fps)
void AUD_setSequencerFPS(AUD_Sound *sequencer, float fps)
{
dynamic_cast<AUD_SequencerFactory *>(sequencer->get())->setFPS(fps);
}
AUD_SEntry *AUD_Sequence_add(AUD_Sound *sequencer, AUD_Sound *sound,
AUD_SEntry *AUD_addSequence(AUD_Sound *sequencer, AUD_Sound *sound,
float begin, float end, float skip)
{
if (!sound)
@@ -947,23 +934,28 @@ AUD_SEntry *AUD_Sequence_add(AUD_Sound *sequencer, AUD_Sound *sound,
return new AUD_SEntry(((AUD_SequencerFactory *)sequencer->get())->add(*sound, begin, end, skip));
}
void AUD_Sequence_remove(AUD_Sound *sequencer, AUD_SEntry *entry)
void AUD_removeSequence(AUD_Sound *sequencer, AUD_SEntry *entry)
{
dynamic_cast<AUD_SequencerFactory *>(sequencer->get())->remove(*entry);
delete entry;
}
void AUD_SequenceEntry_move(AUD_SEntry *entry, float begin, float end, float skip)
void AUD_moveSequence(AUD_SEntry *entry, float begin, float end, float skip)
{
(*entry)->move(begin, end, skip);
}
void AUD_SequenceEntry_setMuted(AUD_SEntry *entry, char mute)
void AUD_muteSequence(AUD_SEntry *entry, char mute)
{
(*entry)->mute(mute);
}
void AUD_SequenceEntry_setSound(AUD_SEntry *entry, AUD_Sound *sound)
void AUD_setRelativeSequence(AUD_SEntry *entry, char relative)
{
(*entry)->setRelative(relative);
}
void AUD_updateSequenceSound(AUD_SEntry *entry, AUD_Sound *sound)
{
if (sound)
(*entry)->setSound(*sound);
@@ -971,7 +963,7 @@ void AUD_SequenceEntry_setSound(AUD_SEntry *entry, AUD_Sound *sound)
(*entry)->setSound(AUD_Sound());
}
void AUD_SequenceEntry_setAnimationData(AUD_SEntry *entry, AUD_AnimateablePropertyType type, int frame, float *data, char animated)
void AUD_setSequenceAnimData(AUD_SEntry *entry, AUD_AnimateablePropertyType type, int frame, float *data, char animated)
{
AUD_AnimateableProperty *prop = (*entry)->getAnimProperty(type);
if (animated) {
@@ -983,7 +975,7 @@ void AUD_SequenceEntry_setAnimationData(AUD_SEntry *entry, AUD_AnimateableProper
}
}
void AUD_Sequence_setAnimationData(AUD_Sound *sequencer, AUD_AnimateablePropertyType type, int frame, float *data, char animated)
void AUD_setSequencerAnimData(AUD_Sound *sequencer, AUD_AnimateablePropertyType type, int frame, float *data, char animated)
{
AUD_AnimateableProperty *prop = dynamic_cast<AUD_SequencerFactory *>(sequencer->get())->getAnimProperty(type);
if (animated) {
@@ -996,76 +988,21 @@ void AUD_Sequence_setAnimationData(AUD_Sound *sequencer, AUD_AnimateableProperty
}
}
void AUD_Sequence_setDistanceModel(AUD_Sound* sequence, AUD_DistanceModel value)
void AUD_updateSequenceData(AUD_SEntry *entry, float volume_max, float volume_min,
float distance_max, float distance_reference, float attenuation,
float cone_angle_outer, float cone_angle_inner, float cone_volume_outer)
{
assert(sequence);
dynamic_cast<AUD_SequencerFactory *>(sequence->get())->setDistanceModel(static_cast<AUD_DistanceModel>(value));
(*entry)->updateAll(volume_max, volume_min, distance_max, distance_reference, attenuation,
cone_angle_outer, cone_angle_inner, cone_volume_outer);
}
void AUD_Sequence_setDopplerFactor(AUD_Sound* sequence, float value)
void AUD_updateSequencerData(AUD_Sound *sequencer, float speed_of_sound,
float factor, AUD_DistanceModel model)
{
assert(sequence);
dynamic_cast<AUD_SequencerFactory *>(sequence->get())->setDopplerFactor(value);
}
void AUD_Sequence_setSpeedOfSound(AUD_Sound* sequence, float value)
{
assert(sequence);
dynamic_cast<AUD_SequencerFactory *>(sequence->get())->setSpeedOfSound(value);
}
void AUD_SequenceEntry_setAttenuation(AUD_SEntry* sequence_entry, float value)
{
assert(sequence_entry);
(*sequence_entry)->setAttenuation(value);
}
void AUD_SequenceEntry_setConeAngleInner(AUD_SEntry* sequence_entry, float value)
{
assert(sequence_entry);
(*sequence_entry)->setConeAngleInner(value);
}
void AUD_SequenceEntry_setConeAngleOuter(AUD_SEntry* sequence_entry, float value)
{
assert(sequence_entry);
(*sequence_entry)->setConeAngleOuter(value);
}
void AUD_SequenceEntry_setConeVolumeOuter(AUD_SEntry* sequence_entry, float value)
{
assert(sequence_entry);
(*sequence_entry)->setConeVolumeOuter(value);
}
void AUD_SequenceEntry_setDistanceMaximum(AUD_SEntry* sequence_entry, float value)
{
assert(sequence_entry);
(*sequence_entry)->setDistanceMaximum(value);
}
void AUD_SequenceEntry_setDistanceReference(AUD_SEntry* sequence_entry, float value)
{
assert(sequence_entry);
(*sequence_entry)->setDistanceReference(value);
}
void AUD_SequenceEntry_setRelative(AUD_SEntry* sequence_entry, int value)
{
assert(sequence_entry);
(*sequence_entry)->setRelative(value);
}
void AUD_SequenceEntry_setVolumeMaximum(AUD_SEntry* sequence_entry, float value)
{
assert(sequence_entry);
(*sequence_entry)->setVolumeMaximum(value);
}
void AUD_SequenceEntry_setVolumeMinimum(AUD_SEntry* sequence_entry, float value)
{
assert(sequence_entry);
(*sequence_entry)->setVolumeMinimum(value);
AUD_SequencerFactory *f = dynamic_cast<AUD_SequencerFactory *>(sequencer->get());
f->setSpeedOfSound(speed_of_sound);
f->setDopplerFactor(factor);
f->setDistanceModel(model);
}
void AUD_setSequencerDeviceSpecs(AUD_Sound *sequencer)
@@ -1073,12 +1010,12 @@ void AUD_setSequencerDeviceSpecs(AUD_Sound *sequencer)
dynamic_cast<AUD_SequencerFactory *>(sequencer->get())->setSpecs(AUD_device->getSpecs().specs);
}
void AUD_Sequence_setSpecs(AUD_Sound *sequencer, AUD_Specs specs)
void AUD_setSequencerSpecs(AUD_Sound *sequencer, AUD_Specs specs)
{
dynamic_cast<AUD_SequencerFactory *>(sequencer->get())->setSpecs(specs);
}
void AUD_seekSynchronizer(AUD_Handle *handle, float time)
void AUD_seekSequencer(AUD_Handle *handle, float time)
{
#ifdef WITH_JACK
AUD_JackDevice *device = dynamic_cast<AUD_JackDevice *>(AUD_device.get());
@@ -1093,7 +1030,7 @@ void AUD_seekSynchronizer(AUD_Handle *handle, float time)
}
}
float AUD_getSynchronizerPosition(AUD_Handle *handle)
float AUD_getSequencerPosition(AUD_Handle *handle)
{
#ifdef WITH_JACK
AUD_JackDevice *device = dynamic_cast<AUD_JackDevice *>(AUD_device.get());
@@ -1108,7 +1045,7 @@ float AUD_getSynchronizerPosition(AUD_Handle *handle)
}
}
void AUD_playSynchronizer()
void AUD_startPlayback()
{
#ifdef WITH_JACK
AUD_JackDevice *device = dynamic_cast<AUD_JackDevice *>(AUD_device.get());
@@ -1118,7 +1055,7 @@ void AUD_playSynchronizer()
#endif
}
void AUD_stopSynchronizer()
void AUD_stopPlayback()
{
#ifdef WITH_JACK
AUD_JackDevice *device = dynamic_cast<AUD_JackDevice *>(AUD_device.get());
@@ -1129,7 +1066,7 @@ void AUD_stopSynchronizer()
}
#ifdef WITH_JACK
void AUD_setSynchronizerCallback(AUD_syncFunction function, void *data)
void AUD_setSyncCallback(AUD_syncFunction function, void *data)
{
AUD_JackDevice *device = dynamic_cast<AUD_JackDevice *>(AUD_device.get());
if (device) {
@@ -1138,7 +1075,7 @@ void AUD_setSynchronizerCallback(AUD_syncFunction function, void *data)
}
#endif
int AUD_isSynchronizerPlaying()
int AUD_doesPlayback()
{
#ifdef WITH_JACK
AUD_JackDevice *device = dynamic_cast<AUD_JackDevice *>(AUD_device.get());
@@ -1214,12 +1151,12 @@ int AUD_readSound(AUD_Sound *sound, sample_t *buffer, int length, int samples_pe
return length;
}
AUD_Sound *AUD_Sound_copy(AUD_Sound *sound)
AUD_Sound *AUD_copy(AUD_Sound *sound)
{
return new boost::shared_ptr<AUD_IFactory>(*sound);
}
void AUD_Handle_free(AUD_Handle *handle)
void AUD_freeHandle(AUD_Handle *handle)
{
delete handle;
}
@@ -1346,9 +1283,14 @@ AUD_Device *AUD_openMixdownDevice(AUD_DeviceSpecs specs, AUD_Sound *sequencer, f
}
}
AUD_Device *AUD_Device_getCurrent(void)
boost::shared_ptr<AUD_IDevice> AUD_getDevice()
{
return &AUD_device;
return AUD_device;
}
AUD_I3DDevice *AUD_get3DDevice()
{
return AUD_3ddevice;
}
int AUD_isJackSupported(void)

View File

@@ -77,26 +77,22 @@ extern void AUD_exitOnce(void);
* \param buffersize The buffersize for the device.
* \return Whether the device has been initialized.
*/
extern AUD_Device* AUD_init(const char* device, AUD_DeviceSpecs specs, int buffersize, const char* name);
extern int AUD_init(AUD_DeviceType device, AUD_DeviceSpecs specs, int buffersize);
/**
* Unitinitializes an audio device.
*/
extern void AUD_exit(AUD_Device* device);
extern void AUD_exit(void);
/**
* Locks the playback device.
*/
extern void AUD_Device_lock(AUD_Device* device);
extern void AUD_lock(void);
/**
* Unlocks the device.
*/
extern void AUD_Device_unlock(AUD_Device* device);
extern AUD_Channels AUD_Device_getChannels(AUD_Device* device);
extern AUD_SampleRate AUD_Device_getRate(AUD_Device* device);
extern void AUD_unlock(void);
/**
* Returns information about a sound.
@@ -110,7 +106,7 @@ extern AUD_SoundInfo AUD_getInfo(AUD_Sound *sound);
* \param filename The filename of the sound file.
* \return A handle of the sound file.
*/
extern AUD_Sound *AUD_Sound_file(const char *filename);
extern AUD_Sound *AUD_load(const char *filename);
/**
* Loads a sound file.
@@ -118,21 +114,21 @@ extern AUD_Sound *AUD_Sound_file(const char *filename);
* \param size The size of the buffer.
* \return A handle of the sound file.
*/
extern AUD_Sound *AUD_Sound_bufferFile(unsigned char *buffer, int size);
extern AUD_Sound *AUD_loadBuffer(unsigned char *buffer, int size);
/**
* Buffers a sound.
* \param sound The sound to buffer.
* \return A handle of the sound buffer.
*/
extern AUD_Sound *AUD_Sound_cache(AUD_Sound *sound);
extern AUD_Sound *AUD_bufferSound(AUD_Sound *sound);
/**
* Rechannels the sound to be mono.
* \param sound The sound to rechannel.
* \return The mono sound.
*/
extern AUD_Sound *AUD_Sound_rechannel(AUD_Sound *sound, AUD_Channels channels);
extern AUD_Sound *AUD_monoSound(AUD_Sound *sound);
/**
* Delays a sound.
@@ -140,7 +136,7 @@ extern AUD_Sound *AUD_Sound_rechannel(AUD_Sound *sound, AUD_Channels channels);
* \param delay The delay in seconds.
* \return A handle of the delayed sound.
*/
extern AUD_Sound *AUD_Sound_delay(AUD_Sound *sound, float delay);
extern AUD_Sound *AUD_delaySound(AUD_Sound *sound, float delay);
/**
* Limits a sound.
@@ -149,21 +145,21 @@ extern AUD_Sound *AUD_Sound_delay(AUD_Sound *sound, float delay);
* \param end The stop time in seconds.
* \return A handle of the limited sound.
*/
extern AUD_Sound *AUD_Sound_limit(AUD_Sound *sound, float start, float end);
extern AUD_Sound *AUD_limitSound(AUD_Sound *sound, float start, float end);
/**
* Ping pongs a sound.
* \param sound The sound to ping pong.
* \return A handle of the ping pong sound.
*/
extern AUD_Sound *AUD_Sound_pingpong(AUD_Sound *sound);
extern AUD_Sound *AUD_pingpongSound(AUD_Sound *sound);
/**
* Loops a sound.
* \param sound The sound to loop.
* \return A handle of the looped sound.
*/
extern AUD_Sound *AUD_Sound_loop(AUD_Sound *sound);
extern AUD_Sound *AUD_loopSound(AUD_Sound *sound);
/**
* Sets a remaining loop count of a looping sound that currently plays.
@@ -171,7 +167,7 @@ extern AUD_Sound *AUD_Sound_loop(AUD_Sound *sound);
* \param loops The count of remaining loops, -1 for infinity.
* \return Whether the handle is valid.
*/
extern int AUD_Handle_setLoopCount(AUD_Handle *handle, int loops);
extern int AUD_setLoop(AUD_Handle *handle, int loops);
/**
* Rectifies a sound.
@@ -184,7 +180,7 @@ extern AUD_Sound *AUD_rectifySound(AUD_Sound *sound);
* Unloads a sound of any type.
* \param sound The handle of the sound.
*/
extern void AUD_Sound_free(AUD_Sound *sound);
extern void AUD_unload(AUD_Sound *sound);
/**
* Plays back a sound file.
@@ -193,30 +189,28 @@ extern void AUD_Sound_free(AUD_Sound *sound);
* paused when its end has been reached.
* \return A handle to the played back sound.
*/
extern AUD_Handle *AUD_Device_play(AUD_Device* device, AUD_Sound *sound, int keep);
extern AUD_Handle *AUD_play(AUD_Sound *sound, int keep);
/**
* Pauses a played back sound.
* \param handle The handle to the sound.
* \return Whether the handle has been playing or not.
*/
extern int AUD_Handle_pause(AUD_Handle *handle);
extern int AUD_pause(AUD_Handle *handle);
/**
* Resumes a paused sound.
* \param handle The handle to the sound.
* \return Whether the handle has been paused or not.
*/
extern int AUD_Handle_resume(AUD_Handle *handle);
extern int AUD_resume(AUD_Handle *handle);
/**
* Stops a playing or paused sound.
* \param handle The handle to the sound.
* \return Whether the handle has been valid or not.
*/
extern int AUD_Handle_stop(AUD_Handle *handle);
extern void AUD_Device_stopAll(void* device);
extern int AUD_stop(AUD_Handle *handle);
/**
* Sets the end behaviour of a playing or paused sound.
@@ -225,7 +219,7 @@ extern void AUD_Device_stopAll(void* device);
* paused when its end has been reached.
* \return Whether the handle has been valid or not.
*/
extern int AUD_Handle_setKeep(AUD_Handle *handle, int keep);
extern int AUD_setKeep(AUD_Handle *handle, int keep);
/**
* Seeks a playing or paused sound.
@@ -233,7 +227,7 @@ extern int AUD_Handle_setKeep(AUD_Handle *handle, int keep);
* \param seekTo From where the sound file should be played back in seconds.
* \return Whether the handle has been valid or not.
*/
extern int AUD_Handle_setPosition(AUD_Handle *handle, float seekTo);
extern int AUD_seek(AUD_Handle *handle, float seekTo);
/**
* Retrieves the playback position of a handle.
@@ -241,39 +235,39 @@ extern int AUD_Handle_setPosition(AUD_Handle *handle, float seekTo);
* \return The current playback position in seconds or 0.0 if the handle is
* invalid.
*/
extern float AUD_Handle_getPosition(AUD_Handle *handle);
extern float AUD_getPosition(AUD_Handle *handle);
/**
* Returns the status of a playing, paused or stopped sound.
* \param handle The handle to the sound.
* \return The status of the sound behind the handle.
*/
extern AUD_Status AUD_Handle_getStatus(AUD_Handle *handle);
extern AUD_Status AUD_getStatus(AUD_Handle *handle);
/**
* Sets the listener location.
* \param location The new location.
*/
extern int AUD_Device_setListenerLocation(const float location[3]);
extern int AUD_setListenerLocation(const float location[3]);
/**
* Sets the listener velocity.
* \param velocity The new velocity.
*/
extern int AUD_Device_setListenerVelocity(const float velocity[3]);
extern int AUD_setListenerVelocity(const float velocity[3]);
/**
* Sets the listener orientation.
* \param orientation The new orientation as quaternion.
*/
extern int AUD_Device_setListenerOrientation(const float orientation[4]);
extern int AUD_setListenerOrientation(const float orientation[4]);
/**
* Sets the speed of sound.
* This value is needed for doppler effect calculation.
* \param speed The new speed of sound.
*/
extern int AUD_Device_setSpeedOfSound(void* device, float speed);
extern int AUD_setSpeedOfSound(float speed);
/**
* Sets the doppler factor.
@@ -281,13 +275,13 @@ extern int AUD_Device_setSpeedOfSound(void* device, float speed);
* listener which is used while calculating the doppler effect.
* \param factor The new doppler factor.
*/
extern int AUD_Device_setDopplerFactor(void* device, float factor);
extern int AUD_setDopplerFactor(float factor);
/**
* Sets the distance model.
* \param model distance model.
*/
extern int AUD_Device_setDistanceModel(void* device, AUD_DistanceModel model);
extern int AUD_setDistanceModel(AUD_DistanceModel model);
/**
* Sets the location of a source.
@@ -295,7 +289,7 @@ extern int AUD_Device_setDistanceModel(void* device, AUD_DistanceModel model);
* \param location The new location.
* \return Whether the action succeeded.
*/
extern int AUD_Handle_setLocation(AUD_Handle *handle, const float location[3]);
extern int AUD_setSourceLocation(AUD_Handle *handle, const float location[3]);
/**
* Sets the velocity of a source.
@@ -303,7 +297,7 @@ extern int AUD_Handle_setLocation(AUD_Handle *handle, const float location[3]);
* \param velocity The new velocity.
* \return Whether the action succeeded.
*/
extern int AUD_Handle_setVelocity(AUD_Handle *handle, const float velocity[3]);
extern int AUD_setSourceVelocity(AUD_Handle *handle, const float velocity[3]);
/**
* Sets the orientation of a source.
@@ -311,7 +305,7 @@ extern int AUD_Handle_setVelocity(AUD_Handle *handle, const float velocity[3]);
* \param orientation The new orientation as quaternion.
* \return Whether the action succeeded.
*/
extern int AUD_Handle_setOrientation(AUD_Handle *handle, const float orientation[4]);
extern int AUD_setSourceOrientation(AUD_Handle *handle, const float orientation[4]);
/**
* Sets whether the source location, velocity and orientation are relative
@@ -320,7 +314,7 @@ extern int AUD_Handle_setOrientation(AUD_Handle *handle, const float orientation
* \param relative Whether the source is relative.
* \return Whether the action succeeded.
*/
extern int AUD_Handle_setRelative(AUD_Handle *handle, int relative);
extern int AUD_setRelative(AUD_Handle *handle, int relative);
/**
* Sets the maximum volume of a source.
@@ -328,7 +322,7 @@ extern int AUD_Handle_setRelative(AUD_Handle *handle, int relative);
* \param volume The new maximum volume.
* \return Whether the action succeeded.
*/
extern int AUD_Handle_setVolumeMaximum(AUD_Handle *handle, float volume);
extern int AUD_setVolumeMaximum(AUD_Handle *handle, float volume);
/**
* Sets the minimum volume of a source.
@@ -336,7 +330,7 @@ extern int AUD_Handle_setVolumeMaximum(AUD_Handle *handle, float volume);
* \param volume The new minimum volume.
* \return Whether the action succeeded.
*/
extern int AUD_Handle_setVolumeMinimum(AUD_Handle *handle, float volume);
extern int AUD_setVolumeMinimum(AUD_Handle *handle, float volume);
/**
* Sets the maximum distance of a source.
@@ -346,7 +340,7 @@ extern int AUD_Handle_setVolumeMinimum(AUD_Handle *handle, float volume);
* \param distance The new maximum distance.
* \return Whether the action succeeded.
*/
extern int AUD_Handle_setDistanceMaximum(AUD_Handle *handle, float distance);
extern int AUD_setDistanceMaximum(AUD_Handle *handle, float distance);
/**
* Sets the reference distance of a source.
@@ -354,7 +348,7 @@ extern int AUD_Handle_setDistanceMaximum(AUD_Handle *handle, float distance);
* \param distance The new reference distance.
* \return Whether the action succeeded.
*/
extern int AUD_Handle_setDistanceReference(AUD_Handle *handle, float distance);
extern int AUD_setDistanceReference(AUD_Handle *handle, float distance);
/**
* Sets the attenuation of a source.
@@ -363,7 +357,7 @@ extern int AUD_Handle_setDistanceReference(AUD_Handle *handle, float distance);
* \param factor The new attenuation.
* \return Whether the action succeeded.
*/
extern int AUD_Handle_setAttenuation(AUD_Handle *handle, float factor);
extern int AUD_setAttenuation(AUD_Handle *handle, float factor);
/**
* Sets the outer angle of the cone of a source.
@@ -371,7 +365,7 @@ extern int AUD_Handle_setAttenuation(AUD_Handle *handle, float factor);
* \param angle The new outer angle of the cone.
* \return Whether the action succeeded.
*/
extern int AUD_Handle_setConeAngleOuter(AUD_Handle *handle, float angle);
extern int AUD_setConeAngleOuter(AUD_Handle *handle, float angle);
/**
* Sets the inner angle of the cone of a source.
@@ -379,7 +373,7 @@ extern int AUD_Handle_setConeAngleOuter(AUD_Handle *handle, float angle);
* \param angle The new inner angle of the cone.
* \return Whether the action succeeded.
*/
extern int AUD_Handle_setConeAngleInner(AUD_Handle *handle, float angle);
extern int AUD_setConeAngleInner(AUD_Handle *handle, float angle);
/**
* Sets the outer volume of the cone of a source.
@@ -389,7 +383,7 @@ extern int AUD_Handle_setConeAngleInner(AUD_Handle *handle, float angle);
* \param volume The new outer volume of the cone.
* \return Whether the action succeeded.
*/
extern int AUD_Handle_setConeVolumeOuter(AUD_Handle *handle, float volume);
extern int AUD_setConeVolumeOuter(AUD_Handle *handle, float volume);
/**
* Sets the volume of a played back sound.
@@ -397,7 +391,7 @@ extern int AUD_Handle_setConeVolumeOuter(AUD_Handle *handle, float volume);
* \param volume The new volume, must be between 0.0 and 1.0.
* \return Whether the action succeeded.
*/
extern int AUD_Handle_setVolume(AUD_Handle *handle, float volume);
extern int AUD_setSoundVolume(AUD_Handle *handle, float volume);
/**
* Sets the pitch of a played back sound.
@@ -405,7 +399,7 @@ extern int AUD_Handle_setVolume(AUD_Handle *handle, float volume);
* \param pitch The new pitch.
* \return Whether the action succeeded.
*/
extern int AUD_Handle_setPitch(AUD_Handle *handle, float pitch);
extern int AUD_setSoundPitch(AUD_Handle *handle, float pitch);
/**
* Opens a read device, with which audio data can be read.
@@ -440,13 +434,13 @@ extern AUD_Handle *AUD_playDevice(AUD_Device *device, AUD_Sound *sound, float se
* played back currently, in that case the buffer is filled with
* silence.
*/
extern int AUD_Device_read(AUD_Device *device, data_t *buffer, int length);
extern int AUD_readDevice(AUD_Device *device, data_t *buffer, int length);
/**
* Closes a read device.
* \param device The read device.
*/
extern void AUD_Device_free(AUD_Device *device);
extern void AUD_closeReadDevice(AUD_Device *device);
/**
* Reads a sound file into a newly created float buffer.
@@ -472,27 +466,27 @@ extern AUD_Handle *AUD_pauseAfter(AUD_Handle *handle, float seconds);
* \param muted Whether the scene is muted.
* \return The new sound scene.
*/
extern AUD_Sound *AUD_Sequence_create(float fps, int muted);
extern AUD_Sound *AUD_createSequencer(float fps, int muted);
/**
* Deletes a sound scene.
* \param sequencer The sound scene.
*/
extern void AUD_Sequence_free(AUD_Sound *sequencer);
extern void AUD_destroySequencer(AUD_Sound *sequencer);
/**
* Sets the muting state of the scene.
* \param sequencer The sound scene.
* \param muted Whether the scene is muted.
*/
extern void AUD_Sequence_setMuted(AUD_Sound *sequencer, int muted);
extern void AUD_setSequencerMuted(AUD_Sound *sequencer, int muted);
/**
* Sets the scene's FPS.
* \param sequencer The sound scene.
* \param fps The new FPS.
*/
extern void AUD_Sequence_setFPS(AUD_Sound *sequencer, float fps);
extern void AUD_setSequencerFPS(AUD_Sound *sequencer, float fps);
/**
* Adds a new entry to the scene.
@@ -503,7 +497,7 @@ extern void AUD_Sequence_setFPS(AUD_Sound *sequencer, float fps);
* \param skip How much seconds should be skipped at the beginning.
* \return The entry added.
*/
extern AUD_SEntry *AUD_Sequence_add(AUD_Sound *sequencer, AUD_Sound *sound,
extern AUD_SEntry *AUD_addSequence(AUD_Sound *sequencer, AUD_Sound *sound,
float begin, float end, float skip);
/**
@@ -511,7 +505,7 @@ extern AUD_SEntry *AUD_Sequence_add(AUD_Sound *sequencer, AUD_Sound *sound,
* \param sequencer The sound scene.
* \param entry The entry to remove.
*/
extern void AUD_Sequence_remove(AUD_Sound *sequencer, AUD_SEntry *entry);
extern void AUD_removeSequence(AUD_Sound *sequencer, AUD_SEntry *entry);
/**
* Moves the entry.
@@ -520,21 +514,30 @@ extern void AUD_Sequence_remove(AUD_Sound *sequencer, AUD_SEntry *entry);
* \param end The new end time or a negative value if unknown.
* \param skip How many seconds to skip at the beginning.
*/
extern void AUD_SequenceEntry_move(AUD_SEntry *entry, float begin, float end, float skip);
extern void AUD_moveSequence(AUD_SEntry *entry, float begin, float end, float skip);
/**
* Sets the muting state of the entry.
* \param entry The sequenced entry.
* \param mute Whether the entry should be muted or not.
*/
extern void AUD_SequenceEntry_setMuted(AUD_SEntry *entry, char mute);
extern void AUD_muteSequence(AUD_SEntry *entry, char mute);
/**
* Sets whether the entrie's location, velocity and orientation are relative
* to the listener.
* \param entry The sequenced entry.
* \param relative Whether the source is relative.
* \return Whether the action succeeded.
*/
extern void AUD_setRelativeSequence(AUD_SEntry *entry, char relative);
/**
* Sets the sound of the entry.
* \param entry The sequenced entry.
* \param sound The new sound.
*/
extern void AUD_SequenceEntry_setSound(AUD_SEntry *entry, AUD_Sound *sound);
extern void AUD_updateSequenceSound(AUD_SEntry *entry, AUD_Sound *sound);
/**
* Writes animation data to a sequenced entry.
@@ -544,7 +547,7 @@ extern void AUD_SequenceEntry_setSound(AUD_SEntry *entry, AUD_Sound *sound);
* \param data The data to write.
* \param animated Whether the attribute is animated.
*/
extern void AUD_SequenceEntry_setAnimationData(AUD_SEntry *entry, AUD_AnimateablePropertyType type, int frame, float *data, char animated);
extern void AUD_setSequenceAnimData(AUD_SEntry *entry, AUD_AnimateablePropertyType type, int frame, float *data, char animated);
/**
* Writes animation data to a sequenced entry.
@@ -554,90 +557,33 @@ extern void AUD_SequenceEntry_setAnimationData(AUD_SEntry *entry, AUD_Animateabl
* \param data The data to write.
* \param animated Whether the attribute is animated.
*/
extern void AUD_Sequence_setAnimationData(AUD_Sound *sequencer, AUD_AnimateablePropertyType type, int frame, float *data, char animated);
extern void AUD_setSequencerAnimData(AUD_Sound *sequencer, AUD_AnimateablePropertyType type, int frame, float *data, char animated);
/**
* Sets the distance model of a sequence.
* param sequence The sequence to set the distance model from.
* param value The new distance model to set.
* Updates all non-animated parameters of the entry.
* \param entry The sequenced entry.
* \param volume_max The maximum volume.
* \param volume_min The minimum volume.
* \param distance_max The maximum distance.
* \param distance_reference The reference distance.
* \param attenuation The attenuation.
* \param cone_angle_outer The outer cone opening angle.
* \param cone_angle_inner The inner cone opening angle.
* \param cone_volume_outer The volume outside the outer cone.
*/
extern void AUD_Sequence_setDistanceModel(AUD_Sound* sequence, AUD_DistanceModel value);
extern void AUD_updateSequenceData(AUD_SEntry *entry, float volume_max, float volume_min,
float distance_max, float distance_reference, float attenuation,
float cone_angle_outer, float cone_angle_inner, float cone_volume_outer);
/**
* Sets the doppler factor of a sequence.
* param sequence The sequence to set the doppler factor from.
* param value The new doppler factor to set.
* Updates all non-animated parameters of the entry.
* \param sequencer The sound scene.
* \param speed_of_sound The speed of sound for doppler calculation.
* \param factor The doppler factor to control the effect's strength.
* \param model The distance model for distance calculation.
*/
extern void AUD_Sequence_setDopplerFactor(AUD_Sound* sequence, float value);
/**
* Sets the speed of sound of a sequence.
* param sequence The sequence to set the speed of sound from.
* param value The new speed of sound to set.
*/
extern void AUD_Sequence_setSpeedOfSound(AUD_Sound* sequence, float value);
/**
* Sets the attenuation of a sequence_entry.
* param sequence_entry The sequence_entry to set the attenuation from.
* param value The new attenuation to set.
*/
extern void AUD_SequenceEntry_setAttenuation(AUD_SEntry* sequence_entry, float value);
/**
* Sets the cone angle inner of a sequence_entry.
* param sequence_entry The sequence_entry to set the cone angle inner from.
* param value The new cone angle inner to set.
*/
extern void AUD_SequenceEntry_setConeAngleInner(AUD_SEntry* sequence_entry, float value);
/**
* Sets the cone angle outer of a sequence_entry.
* param sequence_entry The sequence_entry to set the cone angle outer from.
* param value The new cone angle outer to set.
*/
extern void AUD_SequenceEntry_setConeAngleOuter(AUD_SEntry* sequence_entry, float value);
/**
* Sets the cone volume outer of a sequence_entry.
* param sequence_entry The sequence_entry to set the cone volume outer from.
* param value The new cone volume outer to set.
*/
extern void AUD_SequenceEntry_setConeVolumeOuter(AUD_SEntry* sequence_entry, float value);
/**
* Sets the distance maximum of a sequence_entry.
* param sequence_entry The sequence_entry to set the distance maximum from.
* param value The new distance maximum to set.
*/
extern void AUD_SequenceEntry_setDistanceMaximum(AUD_SEntry* sequence_entry, float value);
/**
* Sets the distance reference of a sequence_entry.
* param sequence_entry The sequence_entry to set the distance reference from.
* param value The new distance reference to set.
*/
extern void AUD_SequenceEntry_setDistanceReference(AUD_SEntry* sequence_entry, float value);
/**
* Sets the relative of a sequence_entry.
* param sequence_entry The sequence_entry to set the relative from.
* param value The new relative to set.
*/
extern void AUD_SequenceEntry_setRelative(AUD_SEntry* sequence_entry, int value);
/**
* Sets the volume maximum of a sequence_entry.
* param sequence_entry The sequence_entry to set the volume maximum from.
* param value The new volume maximum to set.
*/
extern void AUD_SequenceEntry_setVolumeMaximum(AUD_SEntry* sequence_entry, float value);
/**
* Sets the volume minimum of a sequence_entry.
* param sequence_entry The sequence_entry to set the volume minimum from.
* param value The new volume minimum to set.
*/
extern void AUD_SequenceEntry_setVolumeMinimum(AUD_SEntry* sequence_entry, float value);
extern void AUD_updateSequencerData(AUD_Sound *sequencer, float speed_of_sound,
float factor, AUD_DistanceModel model);
/**
* Sets the audio output specification of the sound scene to the specs of the
@@ -651,31 +597,31 @@ extern void AUD_setSequencerDeviceSpecs(AUD_Sound *sequencer);
* \param sequencer The sound scene.
* \param specs The new specification.
*/
extern void AUD_Sequence_setSpecs(AUD_Sound *sequencer, AUD_Specs specs);
extern void AUD_setSequencerSpecs(AUD_Sound *sequencer, AUD_Specs specs);
/**
* Seeks sequenced sound scene playback.
* \param handle Playback handle.
* \param time Time in seconds to seek to.
*/
extern void AUD_seekSynchronizer(AUD_Handle *handle, float time);
extern void AUD_seekSequencer(AUD_Handle *handle, float time);
/**
* Returns the current sound scene playback time.
* \param handle Playback handle.
* \return The playback time in seconds.
*/
extern float AUD_getSynchronizerPosition(AUD_Handle *handle);
extern float AUD_getSequencerPosition(AUD_Handle *handle);
/**
* Starts the playback of jack transport if possible.
*/
extern void AUD_playSynchronizer(void);
extern void AUD_startPlayback(void);
/**
* Stops the playback of jack transport if possible.
*/
extern void AUD_stopSynchronizer(void);
extern void AUD_stopPlayback(void);
#ifdef WITH_JACK
/**
@@ -683,14 +629,14 @@ extern void AUD_stopSynchronizer(void);
* \param function The callback function.
* \param data The data parameter for the callback.
*/
extern void AUD_setSynchronizerCallback(AUD_syncFunction function, void *data);
extern void AUD_setSyncCallback(AUD_syncFunction function, void *data);
#endif
/**
* Returns whether jack transport is currently playing.
* \return Whether jack transport is currently playing.
*/
extern int AUD_isSynchronizerPlaying(void);
extern int AUD_doesPlayback(void);
/**
* Reads a sound into a buffer for drawing at a specific sampling rate.
@@ -707,13 +653,13 @@ extern int AUD_readSound(AUD_Sound *sound, sample_t *buffer, int length, int sam
* \param sound Sound to copy.
* \return Copied sound.
*/
extern AUD_Sound *AUD_Sound_copy(AUD_Sound *sound);
extern AUD_Sound *AUD_copy(AUD_Sound *sound);
/**
* Frees a handle.
* \param channel Handle to free.
*/
extern void AUD_Handle_free(AUD_Handle *channel);
extern void AUD_freeHandle(AUD_Handle *channel);
/**
* Creates a new set.
@@ -801,22 +747,36 @@ extern AUD_Device *AUD_openMixdownDevice(AUD_DeviceSpecs specs, AUD_Sound *seque
* \param sound The sound factory.
* \return The python factory.
*/
extern void *AUD_getPythonSound(AUD_Sound *sound);
extern void *AUD_getPythonFactory(AUD_Sound *sound);
/**
* Retrieves the sound factory of a python factory.
* \param sound The python factory.
* \return The sound factory.
*/
extern AUD_Sound *AUD_getSoundFromPython(void *sound);
extern AUD_Sound *AUD_getPythonSound(void *sound);
#endif
extern AUD_Device *AUD_Device_getCurrent(void);
extern int AUD_isJackSupported(void);
#ifdef __cplusplus
}
#include <boost/shared_ptr.hpp>
class AUD_IDevice;
class AUD_I3DDevice;
/**
* Returns the current playback device.
* \return The playback device.
*/
boost::shared_ptr<AUD_IDevice> AUD_getDevice();
/**
* Returns the current playback 3D device.
* \return The playback 3D device.
*/
AUD_I3DDevice *AUD_get3DDevice();
#endif
#endif //__AUD_C_API_H__

View File

@@ -1,78 +0,0 @@
/*
* ***** BEGIN GPL LICENSE BLOCK *****
*
* Copyright 2009-2011 Jörg Hermann Müller
*
* This file is part of AudaSpace.
*
* Audaspace is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* AudaSpace is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with Audaspace; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
* ***** END GPL LICENSE BLOCK *****
*/
/** \file audaspace/intern/AUD_PyInit.cpp
* \ingroup audaspaceintern
*/
#include "AUD_PyInit.h"
#include <AUD_Sound.h>
#include <python/PySound.h>
#include <python/PyAPI.h>
extern "C" {
extern void *BKE_sound_get_factory(void *sound);
}
static PyObject *AUD_getSoundFromPointer(PyObject *self, PyObject *args)
{
long int lptr;
if (PyArg_Parse(args, "l:_sound_from_pointer", &lptr)) {
if (lptr) {
AUD_Sound* sound = BKE_sound_get_factory((void *) lptr);
if (sound) {
Sound *obj = (Sound *)Sound_empty();
if (obj) {
obj->sound = AUD_Sound_copy(sound);
return (PyObject *) obj;
}
}
}
}
Py_RETURN_NONE;
}
static PyMethodDef meth_sound_from_pointer[] = {
{"_sound_from_pointer", (PyCFunction)AUD_getSoundFromPointer, METH_O,
"_sound_from_pointer(pointer)\n\n"
"Returns the corresponding :class:`Factory` object.\n\n"
":arg pointer: The pointer to the bSound object as long.\n"
":type pointer: long\n"
":return: The corresponding :class:`Factory` object.\n"
":rtype: :class:`Factory`"}
};
PyObject *AUD_initPython(void)
{
PyObject *module = PyInit_aud();
PyModule_AddObject(module, "_sound_from_pointer", (PyObject *)PyCFunction_New(meth_sound_from_pointer, NULL));
PyDict_SetItemString(PyImport_GetModuleDict(), "aud", module);
return module;
}

View File

@@ -1,69 +0,0 @@
/*
* ***** BEGIN GPL LICENSE BLOCK *****
*
* Copyright 2009-2011 Jörg Hermann Müller
*
* This file is part of AudaSpace.
*
* Audaspace is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* AudaSpace is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with Audaspace; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
* ***** END GPL LICENSE BLOCK *****
*/
/** \file audaspace/intern/AUD_Set.cpp
* \ingroup audaspaceintern
*/
#include <set>
#include "AUD_Set.h"
void *AUD_createSet()
{
return new std::set<void *>();
}
void AUD_destroySet(void *set)
{
delete reinterpret_cast<std::set<void *>*>(set);
}
char AUD_removeSet(void *set, void *entry)
{
if (set)
return reinterpret_cast<std::set<void *>*>(set)->erase(entry);
return 0;
}
void AUD_addSet(void *set, void *entry)
{
if (entry)
reinterpret_cast<std::set<void *>*>(set)->insert(entry);
}
void *AUD_getSet(void *set)
{
if (set) {
std::set<void *>* rset = reinterpret_cast<std::set<void *>*>(set);
if (!rset->empty()) {
std::set<void *>::iterator it = rset->begin();
void *result = *it;
rset->erase(it);
return result;
}
}
return (void*) 0;
}

View File

@@ -1,74 +0,0 @@
/*
* ***** BEGIN GPL LICENSE BLOCK *****
*
* Copyright 2009-2011 Jörg Hermann Müller
*
* This file is part of AudaSpace.
*
* Audaspace is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* AudaSpace is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with Audaspace; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
* ***** END GPL LICENSE BLOCK *****
*/
/** \file AUD_Set.h
* \ingroup audaspace
*/
#ifndef __AUD_SET_H__
#define __AUD_SET_H__
#ifdef __cplusplus
extern "C" {
#endif
/**
* Creates a new set.
* \return The new set.
*/
extern void *AUD_createSet(void);
/**
* Deletes a set.
* \param set The set to delete.
*/
extern void AUD_destroySet(void *set);
/**
* Removes an entry from a set.
* \param set The set work on.
* \param entry The entry to remove.
* \return Whether the entry was in the set or not.
*/
extern char AUD_removeSet(void *set, void *entry);
/**
* Adds a new entry to a set.
* \param set The set work on.
* \param entry The entry to add.
*/
extern void AUD_addSet(void *set, void *entry);
/**
* Removes one entry from a set and returns it.
* \param set The set work on.
* \return The entry or NULL if the set is empty.
*/
extern void *AUD_getSet(void *set);
#ifdef __cplusplus
}
#endif
#endif //__AUD_SET_H__

View File

@@ -14,11 +14,6 @@ include(cmake/external_libs.cmake)
# todo: refactor this code to match scons
# note: CXX_HAS_SSE is needed in case passing SSE flags fails altogether (gcc-arm)
if(WITH_CYCLES_WERROR)
ADD_CHECK_C_COMPILER_FLAG(CMAKE_C_FLAGS C_WERROR -Werror)
ADD_CHECK_CXX_COMPILER_FLAG(CMAKE_CXX_FLAGS C_WERROR -Werror)
endif()
if(NOT WITH_CPU_SSE)
set(CXX_HAS_SSE FALSE)
set(CXX_HAS_AVX FALSE)
@@ -159,23 +154,23 @@ add_definitions(
TEST_UNORDERED_MAP_SUPPORT()
if(HAVE_STD_UNORDERED_MAP_HEADER)
if(HAVE_UNORDERED_MAP_IN_STD_NAMESPACE)
add_definitions(-DCYCLES_STD_UNORDERED_MAP)
else()
if(HAVE_UNORDERED_MAP_IN_TR1_NAMESPACE)
add_definitions(-DCYCLES_STD_UNORDERED_MAP_IN_TR1_NAMESPACE)
else()
add_definitions(-DCYCLES_NO_UNORDERED_MAP)
message(STATUS "Replacing unordered_map/set with map/set (warning: slower!)")
endif()
endif()
if(HAVE_UNORDERED_MAP_IN_STD_NAMESPACE)
add_definitions(-DCYCLES_STD_UNORDERED_MAP)
else()
if(HAVE_UNORDERED_MAP_IN_TR1_NAMESPACE)
add_definitions(-DCYCLES_STD_UNORDERED_MAP_IN_TR1_NAMESPACE)
else()
add_definitions(-DCYCLES_NO_UNORDERED_MAP)
message(STATUS "Replacing unordered_map/set with map/set (warning: slower!)")
endif()
endif()
else()
if(HAVE_UNORDERED_MAP_IN_TR1_NAMESPACE)
add_definitions(-DCYCLES_TR1_UNORDERED_MAP)
else()
add_definitions(-DCYCLES_NO_UNORDERED_MAP)
message(STATUS "Replacing unordered_map/set with map/set (warning: slower!)")
endif()
if(HAVE_UNORDERED_MAP_IN_TR1_NAMESPACE)
add_definitions(-DCYCLES_TR1_UNORDERED_MAP)
else()
add_definitions(-DCYCLES_NO_UNORDERED_MAP)
message(STATUS "Replacing unordered_map/set with map/set (warning: slower!)")
endif()
endif()
# Logging capabilities using GLog library.

View File

@@ -31,12 +31,10 @@ set(SRC
blender_session.cpp
blender_shader.cpp
blender_sync.cpp
blender_texture.cpp
CCL_api.h
blender_sync.h
blender_session.h
blender_texture.h
blender_util.h
)

View File

@@ -17,56 +17,11 @@
# <pep8 compliant>
def _is_using_buggy_driver():
import bgl
# We need to be conservative here because in multi-GPU systems display card
# might be quite old, but others one might be just good.
#
# So We shouldn't disable possible good dedicated cards just because display
# card seems weak. And instead we only blacklist configurations which are
# proven to cause problems.
if bgl.glGetString(bgl.GL_VENDOR) == "ATI Technologies Inc.":
import re
version = bgl.glGetString(bgl.GL_VERSION)
if version.endswith("Compatibility Profile Context"):
# Old HD 4xxx and 5xxx series drivers did not have driver version
# in the version string, but thsoe cards do not quite work and
# cusing crashes.
return True
regex = re.compile(".*Compatibility Profile Context ([0-9]+(\.[0-9]+)+)$")
if not regex.match(version):
# Skip cards like FireGL
return False
version = regex.sub("\\1", version).split('.')
return int(version[0]) == 8
return False
def _workaround_buggy_drivers():
if _is_using_buggy_driver():
import _cycles
if hasattr(_cycles, "opencl_disable"):
print("Cycles: OpenGL driver known to be buggy, disabling OpenCL platform.")
_cycles.opencl_disable()
def init():
import bpy
import _cycles
import os.path
# Workaroud posibly buggy legacy drivers which crashes on the OpenCL
# device enumeration.
#
# This checks are not really correct because they might still fail
# in the case of multiple GPUs. However, currently buggy drivers
# are really old and likely to be used in single GPU systems only
# anyway.
#
# Can't do it in the background mode, so we hope OpenCL is no enabled
# in the user preferences.
if not bpy.app.background:
_workaround_buggy_drivers()
path = os.path.dirname(__file__)
user_path = os.path.dirname(os.path.abspath(bpy.utils.user_resource('CONFIG', '')))

View File

@@ -511,19 +511,6 @@ class CyclesRenderSettings(bpy.types.PropertyGroup):
),
)
cls.use_camera_cull = BoolProperty(
name="Use Camera Cull",
description="Allow objects to be culled based on the camera frustum",
default=False,
)
cls.camera_cull_margin = FloatProperty(
name="Camera Cull Margin",
description="Margin for the camera space culling",
default=0.1,
min=0.0, max=5.0
)
@classmethod
def unregister(cls):
del bpy.types.Scene.cycles
@@ -752,12 +739,6 @@ class CyclesWorldSettings(bpy.types.PropertyGroup):
min=1, max=10000,
default=4,
)
cls.max_bounces = IntProperty(
name="Max Bounces",
description="Maximum number of bounces the background light will contribute to the render",
min=0, max=1024,
default=1024,
)
cls.homogeneous_volume = BoolProperty(
name="Homogeneous Volume",
description="When using volume rendering, assume volume has the same density everywhere"
@@ -909,12 +890,6 @@ class CyclesObjectBlurSettings(bpy.types.PropertyGroup):
default=1,
)
cls.use_camera_cull = BoolProperty(
name="Use Camera Cull",
description="Allow this object and its duplicators to be culled by camera space culling",
default=False,
)
@classmethod
def unregister(cls):
del bpy.types.Object.cycles

View File

@@ -438,7 +438,6 @@ class CyclesRender_PT_layer_passes(CyclesButtonsPanel, Panel):
class CyclesRender_PT_views(CyclesButtonsPanel, Panel):
bl_label = "Views"
bl_context = "render_layer"
bl_options = {'DEFAULT_CLOSED'}
def draw_header(self, context):
rd = context.scene.render
@@ -688,8 +687,8 @@ class CyclesObject_PT_motion_blur(CyclesButtonsPanel, Panel):
sub.prop(cob, "motion_steps", text="Steps")
class CyclesObject_PT_cycles_settings(CyclesButtonsPanel, Panel):
bl_label = "Cycles Settings"
class CyclesObject_PT_ray_visibility(CyclesButtonsPanel, Panel):
bl_label = "Ray Visibility"
bl_context = "object"
bl_options = {'DEFAULT_CLOSED'}
@@ -703,13 +702,9 @@ class CyclesObject_PT_cycles_settings(CyclesButtonsPanel, Panel):
def draw(self, context):
layout = self.layout
scene = context.scene
cscene = scene.cycles
ob = context.object
cob = ob.cycles
visibility = ob.cycles_visibility
layout.label(text="Ray Visibility:")
flow = layout.column_flow()
flow.prop(visibility, "camera")
@@ -721,12 +716,6 @@ class CyclesObject_PT_cycles_settings(CyclesButtonsPanel, Panel):
if ob.type != 'LAMP':
flow.prop(visibility, "shadow")
col = layout.column()
col.label(text="Performance:")
row = col.row()
row.active = scene.render.use_simplify and cscene.use_camera_cull
row.prop(cob, "use_camera_cull")
class CYCLES_OT_use_shading_nodes(Operator):
"""Enable nodes on a material, world or lamp"""
@@ -1051,7 +1040,6 @@ class CyclesWorld_PT_settings(CyclesButtonsPanel, Panel):
sub.prop(cworld, "sample_map_resolution")
if use_branched_path(context):
sub.prop(cworld, "samples")
sub.prop(cworld, "max_bounces")
col = split.column()
col.label(text="Volume:")
@@ -1237,8 +1225,7 @@ class CyclesTexture_PT_mapping(CyclesButtonsPanel, Panel):
@classmethod
def poll(cls, context):
node = context.texture_node
# TODO(sergey): perform a faster/nicer check?
return node and hasattr(node, 'texture_mapping') and CyclesButtonsPanel.poll(context)
return node and CyclesButtonsPanel.poll(context)
def draw(self, context):
layout = self.layout
@@ -1462,9 +1449,7 @@ class CyclesScene_PT_simplify(CyclesButtonsPanel, Panel):
def draw(self, context):
layout = self.layout
scene = context.scene
rd = scene.render
cscene = scene.cycles
rd = context.scene.render
layout.active = rd.use_simplify
split = layout.split()
@@ -1479,12 +1464,6 @@ class CyclesScene_PT_simplify(CyclesButtonsPanel, Panel):
col.prop(rd, "simplify_subdivision_render", text="Subdivision")
col.prop(rd, "simplify_child_particles_render", text="Child Particles")
col = layout.column()
col.prop(cscene, "use_camera_cull")
subsub = col.column()
subsub.active = cscene.use_camera_cull
subsub.prop(cscene, "camera_cull_margin")
def draw_device(self, context):
scene = context.scene

View File

@@ -244,11 +244,8 @@ static Transform blender_camera_matrix(const Transform& tfm,
return transform_clear_scale(result);
}
static void blender_camera_viewplane(BlenderCamera *bcam,
int width, int height,
BoundBox2D *viewplane,
float *aspectratio,
float *sensor_size)
static void blender_camera_viewplane(BlenderCamera *bcam, int width, int height,
BoundBox2D *viewplane, float *aspectratio, float *sensor_size)
{
/* dimensions */
float xratio = (float)width*bcam->pixelaspect.x;
@@ -261,34 +258,24 @@ static void blender_camera_viewplane(BlenderCamera *bcam,
/* sensor fitting */
if(bcam->sensor_fit == BlenderCamera::AUTO) {
horizontal_fit = (xratio > yratio);
if(sensor_size != NULL) {
*sensor_size = bcam->sensor_width;
}
*sensor_size = bcam->sensor_width;
}
else if(bcam->sensor_fit == BlenderCamera::HORIZONTAL) {
horizontal_fit = true;
if(sensor_size != NULL) {
*sensor_size = bcam->sensor_width;
}
*sensor_size = bcam->sensor_width;
}
else {
horizontal_fit = false;
if(sensor_size != NULL) {
*sensor_size = bcam->sensor_height;
}
*sensor_size = bcam->sensor_height;
}
if(horizontal_fit) {
if(aspectratio != NULL) {
*aspectratio = xratio/yratio;
}
*aspectratio = xratio/yratio;
xaspect = *aspectratio;
yaspect = 1.0f;
}
else {
if(aspectratio != NULL) {
*aspectratio = yratio/xratio;
}
*aspectratio = yratio/xratio;
xaspect = 1.0f;
yaspect = *aspectratio;
}
@@ -297,37 +284,31 @@ static void blender_camera_viewplane(BlenderCamera *bcam,
if(bcam->type == CAMERA_ORTHOGRAPHIC) {
xaspect = xaspect*bcam->ortho_scale/(*aspectratio*2.0f);
yaspect = yaspect*bcam->ortho_scale/(*aspectratio*2.0f);
if(aspectratio != NULL) {
*aspectratio = bcam->ortho_scale/2.0f;
}
*aspectratio = bcam->ortho_scale/2.0f;
}
if(bcam->type == CAMERA_PANORAMA) {
/* set viewplane */
if(viewplane != NULL) {
*viewplane = bcam->pano_viewplane;
}
*viewplane = bcam->pano_viewplane;
}
else {
/* set viewplane */
if(viewplane != NULL) {
viewplane->left = -xaspect;
viewplane->right = xaspect;
viewplane->bottom = -yaspect;
viewplane->top = yaspect;
viewplane->left = -xaspect;
viewplane->right = xaspect;
viewplane->bottom = -yaspect;
viewplane->top = yaspect;
/* zoom for 3d camera view */
*viewplane = (*viewplane) * bcam->zoom;
/* zoom for 3d camera view */
*viewplane = (*viewplane) * bcam->zoom;
/* modify viewplane with camera shift and 3d camera view offset */
float dx = 2.0f*(*aspectratio*bcam->shift.x + bcam->offset.x*xaspect*2.0f);
float dy = 2.0f*(*aspectratio*bcam->shift.y + bcam->offset.y*yaspect*2.0f);
/* modify viewplane with camera shift and 3d camera view offset */
float dx = 2.0f*(*aspectratio*bcam->shift.x + bcam->offset.x*xaspect*2.0f);
float dy = 2.0f*(*aspectratio*bcam->shift.y + bcam->offset.y*yaspect*2.0f);
viewplane->left += dx;
viewplane->right += dx;
viewplane->bottom += dy;
viewplane->top += dy;
}
viewplane->left += dx;
viewplane->right += dx;
viewplane->bottom += dy;
viewplane->top += dy;
}
}
@@ -405,10 +386,7 @@ static void blender_camera_sync(Camera *cam, BlenderCamera *bcam, int width, int
cam->motion.pre = cam->matrix;
cam->motion.post = cam->matrix;
cam->use_motion = false;
cam->use_perspective_motion = false;
cam->shuttertime = bcam->shuttertime;
cam->fov_pre = cam->fov;
cam->fov_post = cam->fov;
/* border */
cam->border = bcam->border;
@@ -457,14 +435,8 @@ void BlenderSync::sync_camera(BL::RenderSettings b_render, BL::Object b_override
blender_camera_sync(cam, &bcam, width, height);
}
void BlenderSync::sync_camera_motion(BL::RenderSettings b_render,
BL::Object b_ob,
int width, int height,
float motion_time)
void BlenderSync::sync_camera_motion(BL::Object b_ob, float motion_time)
{
if(!b_ob)
return;
Camera *cam = scene->camera;
BL::Array<float, 16> b_ob_matrix;
b_engine.camera_model_matrix(b_ob, b_ob_matrix);
@@ -482,31 +454,6 @@ void BlenderSync::sync_camera_motion(BL::RenderSettings b_render,
cam->use_motion = true;
}
}
if(cam->type == CAMERA_PERSPECTIVE) {
BlenderCamera bcam;
float aspectratio, sensor_size;
blender_camera_init(&bcam, b_render);
blender_camera_from_object(&bcam, b_engine, b_ob);
blender_camera_viewplane(&bcam,
width, height,
NULL,
&aspectratio,
&sensor_size);
/* TODO(sergey): De-duplicate calculation with camera sync. */
float fov = 2.0f * atanf((0.5f * sensor_size) / bcam.lens / aspectratio);
if(fov != cam->fov) {
VLOG(1) << "Camera " << b_ob.name() << " FOV change detected.";
if(motion_time == -1.0f) {
cam->fov_pre = fov;
cam->use_perspective_motion = true;
}
else if(motion_time == 1.0f) {
cam->fov_post = fov;
cam->use_perspective_motion = true;
}
}
}
}
/* Sync 3D View Camera */

View File

@@ -242,16 +242,8 @@ static void create_mesh_volume_attribute(BL::Object b_ob, Mesh *mesh, ImageManag
bool animated = false;
volume_data->manager = image_manager;
volume_data->slot = image_manager->add_image(
Attribute::standard_name(std),
b_ob.ptr.data,
animated,
frame,
is_float,
is_linear,
INTERPOLATION_LINEAR,
EXTENSION_REPEAT,
true);
volume_data->slot = image_manager->add_image(Attribute::standard_name(std),
b_ob.ptr.data, animated, frame, is_float, is_linear, INTERPOLATION_LINEAR, true);
}
static void create_mesh_volume_attributes(Scene *scene, BL::Object b_ob, Mesh *mesh, float frame)

View File

@@ -215,7 +215,6 @@ void BlenderSync::sync_background_light(bool use_portal)
light->map_resolution = get_int(cworld, "sample_map_resolution");
light->shader = scene->default_background;
light->use_mis = sample_as_light;
light->max_bounces = get_int(cworld, "max_bounces");
int samples = get_int(cworld, "samples");
if(get_boolean(cscene, "use_square_samples"))
@@ -235,56 +234,8 @@ void BlenderSync::sync_background_light(bool use_portal)
/* Object */
/* TODO(sergey): Not really optimal, consider approaches based on k-DOP in order
* to reduce number of objects which are wrongly considered visible.
*/
static bool object_boundbox_clip(Scene *scene,
BL::Object b_ob,
Transform& tfm,
float margin)
{
Camera *cam = scene->camera;
Transform& worldtondc = cam->worldtondc;
BL::Array<float, 24> boundbox = b_ob.bound_box();
float3 bb_min = make_float3(FLT_MAX, FLT_MAX, FLT_MAX),
bb_max = make_float3(-FLT_MAX, -FLT_MAX, -FLT_MAX);
bool all_behind = true;
for(int i = 0; i < 8; ++i) {
float3 p = make_float3(boundbox[3 * i + 0],
boundbox[3 * i + 1],
boundbox[3 * i + 2]);
p = transform_point(&tfm, p);
p = transform_point(&worldtondc, p);
if(p.z >= -margin) {
all_behind = false;
}
p /= p.z;
bb_min = min(bb_min, p);
bb_max = max(bb_max, p);
}
if(!all_behind) {
if(bb_min.x >= 1.0f + margin ||
bb_min.y >= 1.0f + margin ||
bb_max.x <= -margin ||
bb_max.y <= -margin)
{
return true;
}
return false;
}
return true;
}
Object *BlenderSync::sync_object(BL::Object b_parent,
int persistent_id[OBJECT_PERSISTENT_ID_SIZE],
BL::DupliObject b_dupli_ob,
Transform& tfm,
uint layer_flag,
float motion_time,
bool hide_tris,
bool use_camera_cull,
float camera_cull_margin,
bool *use_portal)
Object *BlenderSync::sync_object(BL::Object b_parent, int persistent_id[OBJECT_PERSISTENT_ID_SIZE], BL::DupliObject b_dupli_ob,
Transform& tfm, uint layer_flag, float motion_time, bool hide_tris, bool *use_portal)
{
BL::Object b_ob = (b_dupli_ob ? b_dupli_ob.object() : b_parent);
bool motion = motion_time != 0.0f;
@@ -302,11 +253,6 @@ Object *BlenderSync::sync_object(BL::Object b_parent,
if(!object_is_mesh(b_ob))
return NULL;
/* Perform camera space culling. */
if(use_camera_cull && object_boundbox_clip(scene, b_ob, tfm, camera_cull_margin)) {
return NULL;
}
/* key to lookup object */
ObjectKey key(b_parent, persistent_id, b_ob);
Object *object;
@@ -534,18 +480,6 @@ void BlenderSync::sync_objects(BL::SpaceView3D b_v3d, float motion_time)
mesh_motion_synced.clear();
}
bool allow_camera_cull = false;
float camera_cull_margin = 0.0f;
if(b_scene.render().use_simplify()) {
PointerRNA cscene = RNA_pointer_get(&b_scene.ptr, "cycles");
allow_camera_cull = scene->camera->type != CAMERA_PANORAMA &&
!b_scene.render().use_multiview() &&
get_boolean(cscene, "use_camera_cull");
if(allow_camera_cull) {
camera_cull_margin = get_float(cscene, "camera_cull_margin");
}
}
/* object loop */
BL::Scene::object_bases_iterator b_base;
BL::Scene b_sce = b_scene;
@@ -568,12 +502,6 @@ void BlenderSync::sync_objects(BL::SpaceView3D b_v3d, float motion_time)
if(!hide) {
progress.set_sync_status("Synchronizing object", b_ob.name());
PointerRNA cobject = RNA_pointer_get(&b_ob.ptr, "cycles");
bool use_camera_cull = allow_camera_cull && get_boolean(cobject, "use_camera_cull");
if(use_camera_cull) {
/* Need to have proper projection matrix. */
scene->camera->update();
}
if(b_ob.is_duplicator() && !object_render_hide_duplis(b_ob)) {
/* dupli objects */
b_ob.dupli_list_create(b_scene, dupli_settings);
@@ -593,16 +521,7 @@ void BlenderSync::sync_objects(BL::SpaceView3D b_v3d, float motion_time)
BL::Array<int, OBJECT_PERSISTENT_ID_SIZE> persistent_id = b_dup->persistent_id();
/* sync object and mesh or light data */
Object *object = sync_object(b_ob,
persistent_id.data,
*b_dup,
tfm,
ob_layer,
motion_time,
hide_tris,
use_camera_cull,
camera_cull_margin,
&use_portal);
Object *object = sync_object(b_ob, persistent_id.data, *b_dup, tfm, ob_layer, motion_time, hide_tris, &use_portal);
/* sync possible particle data, note particle_id
* starts counting at 1, first is dummy particle */
@@ -622,16 +541,7 @@ void BlenderSync::sync_objects(BL::SpaceView3D b_v3d, float motion_time)
if(!object_render_hide(b_ob, true, true, hide_tris)) {
/* object itself */
Transform tfm = get_transform(b_ob.matrix_world());
sync_object(b_ob,
NULL,
PointerRNA_NULL,
tfm,
ob_layer,
motion_time,
hide_tris,
use_camera_cull,
camera_cull_margin,
&use_portal);
sync_object(b_ob, NULL, PointerRNA_NULL, tfm, ob_layer, motion_time, hide_tris, &use_portal);
}
}
@@ -659,11 +569,7 @@ void BlenderSync::sync_objects(BL::SpaceView3D b_v3d, float motion_time)
mesh_motion_synced.clear();
}
void BlenderSync::sync_motion(BL::RenderSettings b_render,
BL::SpaceView3D b_v3d,
BL::Object b_override,
int width, int height,
void **python_thread_state)
void BlenderSync::sync_motion(BL::SpaceView3D b_v3d, BL::Object b_override, void **python_thread_state)
{
if(scene->need_motion() == Scene::MOTION_NONE)
return;
@@ -683,9 +589,6 @@ void BlenderSync::sync_motion(BL::RenderSettings b_render,
/* note iteration over motion_times set happens in sorted order */
foreach(float relative_time, motion_times) {
VLOG(1) << "Synchronizing motion for the relative time "
<< relative_time << ".";
/* fixed shutter time to get previous and next frame for motion pass */
float shuttertime;
@@ -705,12 +608,8 @@ void BlenderSync::sync_motion(BL::RenderSettings b_render,
python_thread_state_save(python_thread_state);
/* sync camera, only supports two times at the moment */
if(relative_time == -1.0f || relative_time == 1.0f) {
sync_camera_motion(b_render,
b_cam,
width, height,
relative_time);
}
if(relative_time == -1.0f || relative_time == 1.0f)
sync_camera_motion(b_cam, relative_time);
/* sync object */
sync_objects(b_v3d, relative_time);

View File

@@ -22,7 +22,6 @@
#include "blender_session.h"
#include "util_foreach.h"
#include "util_logging.h"
#include "util_md5.h"
#include "util_opengl.h"
#include "util_path.h"
@@ -487,19 +486,6 @@ static PyObject *system_info_func(PyObject * /*self*/, PyObject * /*value*/)
return PyUnicode_FromString(system_info.c_str());
}
#ifdef WITH_OPENCL
static PyObject *opencl_disable_func(PyObject * /*self*/, PyObject * /*value*/)
{
VLOG(2) << "Disabling OpenCL platform.";
#ifdef WIN32
putenv("CYCLES_OPENCL_TEST=NONE");
#else
setenv("CYCLES_OPENCL_TEST", "NONE", 1);
#endif
Py_RETURN_NONE;
}
#endif
static PyMethodDef methods[] = {
{"init", init_func, METH_VARARGS, ""},
{"create", create_func, METH_VARARGS, ""},
@@ -515,9 +501,6 @@ static PyMethodDef methods[] = {
#endif
{"available_devices", available_devices_func, METH_NOARGS, ""},
{"system_info", system_info_func, METH_NOARGS, ""},
#ifdef WITH_OPENCL
{"opencl_disable", opencl_disable_func, METH_NOARGS, ""},
#endif
{NULL, NULL, 0, NULL},
};

View File

@@ -122,12 +122,7 @@ void BlenderSession::create_session()
if(session_pause == false) {
/* full data sync */
sync->sync_view(b_v3d, b_rv3d, width, height);
sync->sync_data(b_render,
b_v3d,
b_engine.camera_override(),
width, height,
&python_thread_state,
b_rlay_name.c_str());
sync->sync_data(b_v3d, b_engine.camera_override(), &python_thread_state);
}
}
else {
@@ -447,6 +442,10 @@ void BlenderSession::render()
/* add passes */
vector<Pass> passes;
Pass::add(PASS_COMBINED, passes);
#ifdef WITH_CYCLES_DEBUG
Pass::add(PASS_BVH_TRAVERSAL_STEPS, passes);
/* Pass::add(PASS_RAY_BOUNCES, passes); */
#endif
if(session_params.device.advanced_shading) {
@@ -478,12 +477,7 @@ void BlenderSession::render()
/* update scene */
sync->sync_camera(b_render, b_engine.camera_override(), width, height);
sync->sync_data(b_render,
b_v3d,
b_engine.camera_override(),
width, height,
&python_thread_state,
b_rlay_name.c_str());
sync->sync_data(b_v3d, b_engine.camera_override(), &python_thread_state, b_rlay_name.c_str());
/* update number of samples per layer */
int samples = sync->get_layer_samples();
@@ -549,11 +543,6 @@ void BlenderSession::bake(BL::Object b_object, const string& pass_type, const in
size_t object_index = OBJECT_NONE;
int tri_offset = 0;
/* Set baking flag in advance, so kernel loading can check if we need
* any baking capabilities.
*/
scene->bake_manager->set_baking(true);
/* ensure kernels are loaded before we do any scene updates */
session->load_kernels();
@@ -576,18 +565,14 @@ void BlenderSession::bake(BL::Object b_object, const string& pass_type, const in
/* update scene */
sync->sync_camera(b_render, b_engine.camera_override(), width, height);
sync->sync_data(b_render,
b_v3d,
b_engine.camera_override(),
width, height,
&python_thread_state,
b_rlay_name.c_str());
sync->sync_data(b_v3d, b_engine.camera_override(), &python_thread_state);
/* get buffer parameters */
SessionParams session_params = BlenderSync::get_session_params(b_engine, b_userpref, b_scene, background);
BufferParams buffer_params = BlenderSync::get_buffer_params(b_render, b_v3d, b_rv3d, scene->camera, width, height);
scene->bake_manager->set_shader_limit((size_t)b_engine.tile_x(), (size_t)b_engine.tile_y());
scene->bake_manager->set_baking(true);
/* set number of samples */
session->tile_manager.set_samples(session_params.samples);
@@ -723,12 +708,7 @@ void BlenderSession::synchronize()
}
/* data and camera synchronize */
sync->sync_data(b_render,
b_v3d,
b_engine.camera_override(),
width, height,
&python_thread_state,
b_rlay_name.c_str());
sync->sync_data(b_v3d, b_engine.camera_override(), &python_thread_state);
if(b_rv3d)
sync->sync_view(b_v3d, b_rv3d, width, height);
@@ -894,12 +874,12 @@ void BlenderSession::update_status_progress()
scene += ", " + b_rview_name;
}
else {
BLI_timecode_string_from_time_simple(time_str, sizeof(time_str), total_time);
BLI_timestr(total_time, time_str, sizeof(time_str));
timestatus = "Time:" + string(time_str) + " | ";
}
if(remaining_time > 0) {
BLI_timecode_string_from_time_simple(time_str, sizeof(time_str), remaining_time);
BLI_timestr(remaining_time, time_str, sizeof(time_str));
timestatus += "Remaining:" + string(time_str) + " | ";
}
@@ -1032,18 +1012,6 @@ void BlenderSession::builtin_image_info(const string &builtin_name, void *builti
is_float = true;
}
else {
/* TODO(sergey): Check we're indeed in shader node tree. */
PointerRNA ptr;
RNA_pointer_create(NULL, &RNA_Node, builtin_data, &ptr);
BL::Node b_node(ptr);
if(b_node.is_a(&RNA_ShaderNodeTexPointDensity)) {
BL::ShaderNodeTexPointDensity b_point_density_node(b_node);
channels = 4;
width = height = depth = b_point_density_node.resolution();
is_float = true;
}
}
}
bool BlenderSession::builtin_image_pixels(const string &builtin_name, void *builtin_data, unsigned char *pixels)
@@ -1186,17 +1154,6 @@ bool BlenderSession::builtin_image_float_pixels(const string &builtin_name, void
fprintf(stderr, "Cycles error: unexpected smoke volume resolution, skipping\n");
}
else {
/* TODO(sergey): Check we're indeed in shader node tree. */
PointerRNA ptr;
RNA_pointer_create(NULL, &RNA_Node, builtin_data, &ptr);
BL::Node b_node(ptr);
if(b_node.is_a(&RNA_ShaderNodeTexPointDensity)) {
BL::ShaderNodeTexPointDensity b_point_density_node(b_node);
int length;
b_point_density_node.calc_point_density(b_scene, &length, &pixels);
}
}
return false;
}

View File

@@ -22,7 +22,6 @@
#include "scene.h"
#include "shader.h"
#include "blender_texture.h"
#include "blender_sync.h"
#include "blender_util.h"
@@ -590,17 +589,14 @@ static ShaderNode *add_node(Scene *scene,
/* TODO(sergey): Does not work properly when we change builtin type. */
if(b_image.is_updated()) {
scene->image_manager->tag_reload_image(
image->filename,
image->builtin_data,
(InterpolationType)b_image_node.interpolation(),
(ExtensionType)b_image_node.extension());
scene->image_manager->tag_reload_image(image->filename,
image->builtin_data,
(InterpolationType)b_image_node.interpolation());
}
}
image->color_space = ImageTextureNode::color_space_enum[(int)b_image_node.color_space()];
image->projection = ImageTextureNode::projection_enum[(int)b_image_node.projection()];
image->interpolation = (InterpolationType)b_image_node.interpolation();
image->extension = (ExtensionType)b_image_node.extension();
image->projection_blend = b_image_node.projection_blend();
get_tex_mapping(&image->tex_mapping, b_image_node.texture_mapping());
node = image;
@@ -633,8 +629,7 @@ static ShaderNode *add_node(Scene *scene,
if(b_image.is_updated()) {
scene->image_manager->tag_reload_image(env->filename,
env->builtin_data,
INTERPOLATION_LINEAR,
EXTENSION_REPEAT);
INTERPOLATION_LINEAR);
}
}
env->color_space = EnvironmentTextureNode::color_space_enum[(int)b_env_node.color_space()];
@@ -741,36 +736,6 @@ static ShaderNode *add_node(Scene *scene,
uvm->from_dupli = b_uvmap_node.from_dupli();
node = uvm;
}
else if(b_node.is_a(&RNA_ShaderNodeTexPointDensity)) {
BL::ShaderNodeTexPointDensity b_point_density_node(b_node);
PointDensityTextureNode *point_density = new PointDensityTextureNode();
point_density->filename = b_point_density_node.name();
point_density->space =
PointDensityTextureNode::space_enum[(int)b_point_density_node.space()];
point_density->interpolation =
(InterpolationType)b_point_density_node.interpolation();
point_density->builtin_data = b_point_density_node.ptr.data;
/* Transformation form world space to texture space. */
BL::Object b_ob(b_point_density_node.object());
if(b_ob) {
float3 loc, size;
point_density_texture_space(b_point_density_node, loc, size);
point_density->tfm =
transform_translate(-loc) * transform_scale(size) *
transform_inverse(get_transform(b_ob.matrix_world()));
}
/* TODO(sergey): Use more proper update flag. */
if(true) {
scene->image_manager->tag_reload_image(
point_density->filename,
point_density->builtin_data,
point_density->interpolation,
EXTENSION_REPEAT);
}
node = point_density;
}
if(node)
graph->add(node);

View File

@@ -145,12 +145,7 @@ bool BlenderSync::sync_recalc()
return recalc;
}
void BlenderSync::sync_data(BL::RenderSettings b_render,
BL::SpaceView3D b_v3d,
BL::Object b_override,
int width, int height,
void **python_thread_state,
const char *layer)
void BlenderSync::sync_data(BL::SpaceView3D b_v3d, BL::Object b_override, void **python_thread_state, const char *layer)
{
sync_render_layers(b_v3d, layer);
sync_integrator();
@@ -162,11 +157,7 @@ void BlenderSync::sync_data(BL::RenderSettings b_render,
mesh_synced.clear(); /* use for objects and motion sync */
sync_objects(b_v3d);
sync_motion(b_render,
b_v3d,
b_override,
width, height,
python_thread_state);
sync_motion(b_v3d, b_override, python_thread_state);
mesh_synced.clear();
}

View File

@@ -53,12 +53,7 @@ public:
/* sync */
bool sync_recalc();
void sync_data(BL::RenderSettings b_render,
BL::SpaceView3D b_v3d,
BL::Object b_override,
int width, int height,
void **python_thread_state,
const char *layer = 0);
void sync_data(BL::SpaceView3D b_v3d, BL::Object b_override, void **python_thread_state, const char *layer = 0);
void sync_render_layers(BL::SpaceView3D b_v3d, const char *layer);
void sync_integrator();
void sync_camera(BL::RenderSettings b_render, BL::Object b_override, int width, int height);
@@ -80,11 +75,7 @@ private:
void sync_lamps(bool update_all);
void sync_materials(bool update_all);
void sync_objects(BL::SpaceView3D b_v3d, float motion_time = 0.0f);
void sync_motion(BL::RenderSettings b_render,
BL::SpaceView3D b_v3d,
BL::Object b_override,
int width, int height,
void **python_thread_state);
void sync_motion(BL::SpaceView3D b_v3d, BL::Object b_override, void **python_thread_state);
void sync_film();
void sync_view();
void sync_world(bool update_all);
@@ -94,23 +85,12 @@ private:
void sync_nodes(Shader *shader, BL::ShaderNodeTree b_ntree);
Mesh *sync_mesh(BL::Object b_ob, bool object_updated, bool hide_tris);
void sync_curves(Mesh *mesh, BL::Mesh b_mesh, BL::Object b_ob, bool motion, int time_index = 0);
Object *sync_object(BL::Object b_parent,
int persistent_id[OBJECT_PERSISTENT_ID_SIZE],
BL::DupliObject b_dupli_ob,
Transform& tfm,
uint layer_flag,
float motion_time,
bool hide_tris,
bool use_camera_cull,
float camera_cull_margin,
bool *use_portal);
Object *sync_object(BL::Object b_parent, int persistent_id[OBJECT_PERSISTENT_ID_SIZE], BL::DupliObject b_dupli_ob,
Transform& tfm, uint layer_flag, float motion_time, bool hide_tris, bool *use_portal);
void sync_light(BL::Object b_parent, int persistent_id[OBJECT_PERSISTENT_ID_SIZE], BL::Object b_ob, Transform& tfm, bool *use_portal);
void sync_background_light(bool use_portal);
void sync_mesh_motion(BL::Object b_ob, Object *object, float motion_time);
void sync_camera_motion(BL::RenderSettings b_render,
BL::Object b_ob,
int width, int height,
float motion_time);
void sync_camera_motion(BL::Object b_ob, float motion_time);
/* particles */
bool sync_dupli_particle(BL::Object b_ob, BL::DupliObject b_dup, Object *object);

View File

@@ -1,116 +0,0 @@
/*
* Copyright 2011-2015 Blender Foundation
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include "blender_texture.h"
CCL_NAMESPACE_BEGIN
namespace {
/* Point density helpers. */
static void density_texture_space_invert(float3& loc,
float3& size)
{
if(size.x != 0.0f) size.x = 0.5f/size.x;
if(size.y != 0.0f) size.y = 0.5f/size.y;
if(size.z != 0.0f) size.z = 0.5f/size.z;
loc = loc*size - make_float3(0.5f, 0.5f, 0.5f);
}
static void density_object_texture_space(BL::Object b_ob,
float radius,
float3& loc,
float3& size)
{
if(b_ob.type() == BL::Object::type_MESH) {
BL::Mesh b_mesh(b_ob.data());
loc = get_float3(b_mesh.texspace_location());
size = get_float3(b_mesh.texspace_size());
}
else {
/* TODO(sergey): Not supported currently. */
}
/* Adjust texture space to include density points on the boundaries. */
size = size + make_float3(radius, radius, radius);
density_texture_space_invert(loc, size);
}
static void density_particle_system_texture_space(
BL::Object b_ob,
BL::ParticleSystem b_particle_system,
float radius,
float3& loc,
float3& size)
{
if(b_particle_system.settings().type() == BL::ParticleSettings::type_HAIR) {
/* TODO(sergey): Not supported currently. */
return;
}
Transform tfm = get_transform(b_ob.matrix_world());
Transform itfm = transform_inverse(tfm);
float3 min = make_float3(FLT_MAX, FLT_MAX, FLT_MAX),
max = make_float3(-FLT_MAX, -FLT_MAX, -FLT_MAX);
float3 particle_size = make_float3(radius, radius, radius);
for(int i = 0; i < b_particle_system.particles.length(); ++i) {
BL::Particle particle = b_particle_system.particles[i];
float3 location = get_float3(particle.location());
location = transform_point(&itfm, location);
min = ccl::min(min, location - particle_size);
max = ccl::max(max, location + particle_size);
}
/* Calculate texture space from the particle bounds. */
loc = (min + max) * 0.5f;
size = (max - min) * 0.5f;
density_texture_space_invert(loc, size);
}
} /* namespace */
void point_density_texture_space(BL::ShaderNodeTexPointDensity b_point_density_node,
float3& loc,
float3& size)
{
/* Fallback values. */
loc = make_float3(0.0f, 0.0f, 0.0f);
size = make_float3(0.0f, 0.0f, 0.0f);
BL::Object b_ob(b_point_density_node.object());
if(!b_ob) {
return;
}
if(b_point_density_node.point_source() ==
BL::ShaderNodeTexPointDensity::point_source_PARTICLE_SYSTEM)
{
BL::ParticleSystem b_particle_system(
b_point_density_node.particle_system());
if(b_particle_system) {
density_particle_system_texture_space(b_ob,
b_particle_system,
b_point_density_node.radius(),
loc,
size);
}
}
else {
density_object_texture_space(b_ob,
b_point_density_node.radius(),
loc,
size);
}
}
CCL_NAMESPACE_END

View File

@@ -1,31 +0,0 @@
/*
* Copyright 2011-2015 Blender Foundation
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef __BLENDER_TEXTURE_H__
#define __BLENDER_TEXTURE_H__
#include <stdlib.h>
#include "blender_sync.h"
CCL_NAMESPACE_BEGIN
void point_density_texture_space(BL::ShaderNodeTexPointDensity b_point_density_node,
float3& loc,
float3& size);
CCL_NAMESPACE_END
#endif /* __BLENDER_TEXTURE_H__ */

View File

@@ -28,7 +28,7 @@
* todo: clean this up ... */
extern "C" {
size_t BLI_timecode_string_from_time_simple(char *str, size_t maxlen, double time_seconds);
void BLI_timestr(double _time, char *str, size_t maxlen);
void BKE_image_user_frame_calc(void *iuser, int cfra, int fieldnr);
void BKE_image_user_file_path(void *iuser, void *ima, char *path);
unsigned char *BKE_image_get_pixels_for_frame(void *image, int frame);

View File

@@ -31,29 +31,6 @@
CCL_NAMESPACE_BEGIN
/* Device Requested Features */
std::ostream& operator <<(std::ostream &os,
const DeviceRequestedFeatures& requested_features)
{
os << "Experimental features: "
<< (requested_features.experimental ? "On" : "Off") << std::endl;
os << "Max closure count: " << requested_features.max_closure << std::endl;
os << "Max nodes group: " << requested_features.max_nodes_group << std::endl;
/* TODO(sergey): Decode bitflag into list of names. */
os << "Nodes features: " << requested_features.nodes_features << std::endl;
/* TODO(sergey): Make it utility function to convert bool to string. */
os << "Use hair: "
<< (requested_features.use_hair ? "True" : "False") << std::endl;
os << "Use object motion: "
<< (requested_features.use_object_motion ? "True" : "False") << std::endl;
os << "Use camera motion: "
<< (requested_features.use_camera_motion ? "True" : "False") << std::endl;
os << "Use Baking: "
<< (requested_features.use_baking ? "True" : "False") << std::endl;
return os;
}
/* Device */
Device::~Device()

View File

@@ -97,9 +97,6 @@ public:
bool use_object_motion;
bool use_camera_motion;
/* Denotes whether baking functionality is needed. */
bool use_baking;
DeviceRequestedFeatures()
{
/* TODO(sergey): Find more meaningful defaults. */
@@ -110,7 +107,6 @@ public:
use_hair = false;
use_object_motion = false;
use_camera_motion = false;
use_baking = false;
}
bool modified(const DeviceRequestedFeatures& requested_features)
@@ -118,18 +114,10 @@ public:
return !(experimental == requested_features.experimental &&
max_closure == requested_features.max_closure &&
max_nodes_group == requested_features.max_nodes_group &&
nodes_features == requested_features.nodes_features &&
use_hair == requested_features.use_hair &&
use_object_motion == requested_features.use_object_motion &&
use_camera_motion == requested_features.use_camera_motion &&
use_baking == requested_features.use_baking);
nodes_features == requested_features.nodes_features);
}
};
std::ostream& operator <<(std::ostream &os,
const DeviceRequestedFeatures& requested_features);
/* Device */
struct DeviceDrawParams {
@@ -173,10 +161,10 @@ public:
virtual void tex_alloc(const char * /*name*/,
device_memory& /*mem*/,
InterpolationType interpolation = INTERPOLATION_NONE,
ExtensionType extension = EXTENSION_REPEAT)
bool periodic = false)
{
(void)interpolation; /* Ignored. */
(void)extension; /* Ignored. */
(void)periodic; /* Ignored. */
};
virtual void tex_free(device_memory& /*mem*/) {};

View File

@@ -123,20 +123,10 @@ public:
kernel_const_copy(&kernel_globals, name, host, size);
}
void tex_alloc(const char *name,
device_memory& mem,
InterpolationType interpolation,
ExtensionType extension)
void tex_alloc(const char *name, device_memory& mem, InterpolationType interpolation, bool /*periodic*/)
{
VLOG(1) << "Texture allocate: " << name << ", " << mem.memory_size() << " bytes.";
kernel_tex_copy(&kernel_globals,
name,
mem.data_pointer,
mem.data_width,
mem.data_height,
mem.data_depth,
interpolation,
extension);
kernel_tex_copy(&kernel_globals, name, mem.data_pointer, mem.data_width, mem.data_height, mem.data_depth, interpolation);
mem.device_pointer = mem.data_pointer;
mem.device_size = mem.memory_size();
stats.mem_alloc(mem.device_size);

View File

@@ -416,10 +416,7 @@ public:
cuda_pop_context();
}
void tex_alloc(const char *name,
device_memory& mem,
InterpolationType interpolation,
ExtensionType extension)
void tex_alloc(const char *name, device_memory& mem, InterpolationType interpolation, bool periodic)
{
/* todo: support 3D textures, only CPU for now */
VLOG(1) << "Texture allocate: " << name << ", " << mem.memory_size() << " bytes.";
@@ -513,19 +510,13 @@ public:
cuda_assert(cuTexRefSetFlags(texref, CU_TRSF_READ_AS_INTEGER));
}
switch(extension) {
case EXTENSION_REPEAT:
cuda_assert(cuTexRefSetAddressMode(texref, 0, CU_TR_ADDRESS_MODE_WRAP));
cuda_assert(cuTexRefSetAddressMode(texref, 1, CU_TR_ADDRESS_MODE_WRAP));
break;
case EXTENSION_EXTEND:
cuda_assert(cuTexRefSetAddressMode(texref, 0, CU_TR_ADDRESS_MODE_CLAMP));
cuda_assert(cuTexRefSetAddressMode(texref, 1, CU_TR_ADDRESS_MODE_CLAMP));
break;
case EXTENSION_CLIP:
cuda_assert(cuTexRefSetAddressMode(texref, 0, CU_TR_ADDRESS_MODE_BORDER));
cuda_assert(cuTexRefSetAddressMode(texref, 1, CU_TR_ADDRESS_MODE_BORDER));
break;
if(periodic) {
cuda_assert(cuTexRefSetAddressMode(texref, 0, CU_TR_ADDRESS_MODE_WRAP));
cuda_assert(cuTexRefSetAddressMode(texref, 1, CU_TR_ADDRESS_MODE_WRAP));
}
else {
cuda_assert(cuTexRefSetAddressMode(texref, 0, CU_TR_ADDRESS_MODE_CLAMP));
cuda_assert(cuTexRefSetAddressMode(texref, 1, CU_TR_ADDRESS_MODE_CLAMP));
}
cuda_assert(cuTexRefSetFormat(texref, format, mem.data_elements));

View File

@@ -212,14 +212,11 @@ public:
{
data_size = width * ((height == 0)? 1: height) * ((depth == 0)? 1: depth);
data.resize(data_size);
data_pointer = (device_ptr)&data[0];
data_width = width;
data_height = height;
data_depth = depth;
if(data_size == 0) {
data_pointer = 0;
return NULL;
}
data_pointer = (device_ptr)&data[0];
return &data[0];
}

View File

@@ -169,17 +169,13 @@ public:
sub.device->const_copy_to(name, host, size);
}
void tex_alloc(const char *name,
device_memory& mem,
InterpolationType
interpolation,
ExtensionType extension)
void tex_alloc(const char *name, device_memory& mem, InterpolationType interpolation, bool periodic)
{
VLOG(1) << "Texture allocate: " << name << ", " << mem.memory_size() << " bytes.";
foreach(SubDevice& sub, devices) {
mem.device_pointer = 0;
sub.device->tex_alloc(name, mem, interpolation, extension);
sub.device->tex_alloc(name, mem, interpolation, periodic);
sub.ptr_map[unique_ptr] = mem.device_pointer;
}

View File

@@ -163,10 +163,7 @@ public:
snd.write_buffer(host, size);
}
void tex_alloc(const char *name,
device_memory& mem,
InterpolationType interpolation,
ExtensionType extension)
void tex_alloc(const char *name, device_memory& mem, InterpolationType interpolation, bool periodic)
{
VLOG(1) << "Texture allocate: " << name << ", " << mem.memory_size() << " bytes.";
@@ -181,7 +178,7 @@ public:
snd.add(name_string);
snd.add(mem);
snd.add(interpolation);
snd.add(extension);
snd.add(periodic);
snd.write();
snd.write_buffer((void*)mem.data_pointer, mem.memory_size());
}
@@ -574,13 +571,13 @@ protected:
network_device_memory mem;
string name;
InterpolationType interpolation;
ExtensionType extension_type;
bool periodic;
device_ptr client_pointer;
rcv.read(name);
rcv.read(mem);
rcv.read(interpolation);
rcv.read(extension_type);
rcv.read(periodic);
lock.unlock();
client_pointer = mem.device_pointer;
@@ -596,7 +593,7 @@ protected:
rcv.read_buffer((uint8_t*)mem.data_pointer, data_size);
device->tex_alloc(name.c_str(), mem, interpolation, extension_type);
device->tex_alloc(name.c_str(), mem, interpolation, periodic);
pointer_mapping_insert(client_pointer, mem.device_pointer);
}

View File

@@ -64,20 +64,10 @@ CCL_NAMESPACE_BEGIN
struct OpenCLPlatformDevice {
OpenCLPlatformDevice(cl_platform_id platform_id,
const string& platform_name,
cl_device_id device_id,
cl_device_type device_type,
const string& device_name)
: platform_id(platform_id),
platform_name(platform_name),
device_id(device_id),
device_type(device_type),
device_name(device_name) {}
cl_device_id device_id)
: platform_id(platform_id), device_id(device_id) {}
cl_platform_id platform_id;
string platform_name;
cl_device_id device_id;
cl_device_type device_type;
string device_name;
};
namespace {
@@ -87,8 +77,6 @@ cl_device_type opencl_device_type()
char *device = getenv("CYCLES_OPENCL_TEST");
if(device) {
if(strcmp(device, "NONE") == 0)
return 0;
if(strcmp(device, "ALL") == 0)
return CL_DEVICE_TYPE_ALL;
else if(strcmp(device, "DEFAULT") == 0)
@@ -115,14 +103,12 @@ bool opencl_kernel_use_advanced_shading(const string& platform)
if(platform == "NVIDIA CUDA")
return true;
else if(platform == "Apple")
return true;
return false;
else if(platform == "AMD Accelerated Parallel Processing")
return true;
else if(platform == "Intel(R) OpenCL")
return true;
/* Make sure officially unsupported OpenCL platforms
* does not set up to use advanced shading.
*/
return false;
}
@@ -155,10 +141,7 @@ bool opencl_device_supported(const string& platform_name,
if(platform_name == "AMD Accelerated Parallel Processing" &&
device_type == CL_DEVICE_TYPE_GPU)
{
return true;
}
if(platform_name == "Apple" && device_type == CL_DEVICE_TYPE_GPU) {
return true;
return true;;
}
return false;
}
@@ -227,66 +210,39 @@ void opencl_get_usable_devices(vector<OpenCLPlatformDevice> *usable_devices)
(getenv("CYCLES_OPENCL_TEST") != NULL) ||
(getenv("CYCLES_OPENCL_SPLIT_KERNEL_TEST")) != NULL;
const cl_device_type device_type = opencl_device_type();
static bool first_time = true;
#define FIRST_VLOG(severity) if(first_time) VLOG(severity)
usable_devices->clear();
if(device_type == 0) {
FIRST_VLOG(2) << "OpenCL devices are forced to be disabled.";
first_time = false;
return;
}
vector<cl_device_id> device_ids;
cl_uint num_devices = 0;
vector<cl_platform_id> platform_ids;
cl_uint num_platforms = 0;
/* Number of the devices added to the device info list. */
cl_uint num_added_devices = 0;
/* Get devices. */
if(clGetPlatformIDs(0, NULL, &num_platforms) != CL_SUCCESS ||
num_platforms == 0)
{
FIRST_VLOG(2) << "No OpenCL platforms were found.";
first_time = false;
return;
}
platform_ids.resize(num_platforms);
if(clGetPlatformIDs(num_platforms, &platform_ids[0], NULL) != CL_SUCCESS) {
FIRST_VLOG(2) << "Failed to fetch platform IDs from the driver..";
first_time = false;
return;
}
/* Devices are numbered consecutively across platforms. */
for(int platform = 0; platform < num_platforms; platform++) {
int num_base = 0;
for(int platform = 0;
platform < num_platforms;
platform++, num_base += num_added_devices)
{
cl_platform_id platform_id = platform_ids[platform];
char pname[256];
if(clGetPlatformInfo(platform_id,
CL_PLATFORM_NAME,
sizeof(pname),
&pname,
NULL) != CL_SUCCESS)
{
FIRST_VLOG(2) << "Failed to get platform name, ignoring.";
continue;
}
string platform_name = pname;
FIRST_VLOG(2) << "Enumerating devices for platform "
<< platform_name << ".";
if(!opencl_platform_version_check(platform_id)) {
FIRST_VLOG(2) << "Ignoring platform " << platform_name
<< " due to too old compiler version.";
continue;
}
num_devices = 0;
num_devices = num_added_devices = 0;
if(clGetDeviceIDs(platform_id,
device_type,
0,
NULL,
&num_devices) != CL_SUCCESS || num_devices == 0)
{
FIRST_VLOG(2) << "Ignoring platform " << platform_name
<< ", failed to fetch number of devices.";
continue;
}
device_ids.resize(num_devices);
@@ -296,64 +252,36 @@ void opencl_get_usable_devices(vector<OpenCLPlatformDevice> *usable_devices)
&device_ids[0],
NULL) != CL_SUCCESS)
{
FIRST_VLOG(2) << "Ignoring platform " << platform_name
<< ", failed to fetch devices list.";
continue;
}
if(!opencl_platform_version_check(platform_ids[platform])) {
continue;
}
char pname[256];
clGetPlatformInfo(platform_id,
CL_PLATFORM_NAME,
sizeof(pname),
&pname,
NULL);
string platform_name = pname;
for(int num = 0; num < num_devices; num++) {
cl_device_id device_id = device_ids[num];
char device_name[1024] = "\0";
if(clGetDeviceInfo(device_id,
CL_DEVICE_NAME,
sizeof(device_name),
&device_name,
NULL) != CL_SUCCESS)
{
FIRST_VLOG(2) << "Failed to fetch device name, ignoring.";
continue;
}
if(!opencl_device_version_check(device_id)) {
FIRST_VLOG(2) << "Ignoting device " << device_name
<< " due to old compiler version.";
continue;
}
if(force_all_platforms ||
opencl_device_supported(platform_name, device_id))
{
cl_device_type device_type;
if(clGetDeviceInfo(device_id,
CL_DEVICE_TYPE,
sizeof(cl_device_type),
&device_type,
NULL) != CL_SUCCESS)
{
FIRST_VLOG(2) << "Ignoting device " << device_name
<< ", faield to fetch device type.";
continue;
}
FIRST_VLOG(2) << "Adding new device " << device_name << ".";
usable_devices->push_back(OpenCLPlatformDevice(platform_id,
platform_name,
device_id,
device_type,
device_name));
}
else {
FIRST_VLOG(2) << "Ignoting device " << device_name
<< ", not officially supported yet.";
device_id));
}
}
}
first_time = false;
}
} /* namespace */
/* Thread safe cache for contexts and programs.
*
* TODO(sergey): Make it more generous, so it can contain any type of program
* without hardcoding possible program types in the slot.
*/
/* thread safe cache for contexts and programs */
class OpenCLCache
{
struct Slot
@@ -365,16 +293,13 @@ class OpenCLCache
/* cl_program for megakernel (used in OpenCLDeviceMegaKernel) */
cl_program ocl_dev_megakernel_program;
Slot() : mutex(NULL),
context(NULL),
ocl_dev_base_program(NULL),
ocl_dev_megakernel_program(NULL) {}
Slot() : mutex(NULL), context(NULL), ocl_dev_base_program(NULL), ocl_dev_megakernel_program(NULL) {}
Slot(const Slot& rhs)
: mutex(rhs.mutex),
context(rhs.context),
ocl_dev_base_program(rhs.ocl_dev_base_program),
ocl_dev_megakernel_program(rhs.ocl_dev_megakernel_program)
Slot(const Slot &rhs)
: mutex(rhs.mutex)
, context(rhs.context)
, ocl_dev_base_program(rhs.ocl_dev_base_program)
, ocl_dev_megakernel_program(rhs.ocl_dev_megakernel_program)
{
/* copy can only happen in map insert, assert that */
assert(mutex == NULL);
@@ -421,14 +346,12 @@ class OpenCLCache
* will be holding a lock for the cache. slot_locker should refer to a
* default constructed thread_scoped_lock */
template<typename T>
static T get_something(cl_platform_id platform,
cl_device_id device,
T Slot::*member,
thread_scoped_lock& slot_locker)
static T get_something(cl_platform_id platform, cl_device_id device,
T Slot::*member, thread_scoped_lock &slot_locker)
{
assert(platform != NULL);
OpenCLCache& self = global_instance();
OpenCLCache &self = global_instance();
thread_scoped_lock cache_lock(self.cache_lock);
@@ -461,11 +384,8 @@ class OpenCLCache
/* store something in the cache. you MUST have tried to get the item before storing to it */
template<typename T>
static void store_something(cl_platform_id platform,
cl_device_id device,
T thing,
T Slot::*member,
thread_scoped_lock& slot_locker)
static void store_something(cl_platform_id platform, cl_device_id device, T thing,
T Slot::*member, thread_scoped_lock &slot_locker)
{
assert(platform != NULL);
assert(device != NULL);
@@ -497,14 +417,10 @@ public:
};
/* see get_something comment */
static cl_context get_context(cl_platform_id platform,
cl_device_id device,
thread_scoped_lock& slot_locker)
static cl_context get_context(cl_platform_id platform, cl_device_id device,
thread_scoped_lock &slot_locker)
{
cl_context context = get_something<cl_context>(platform,
device,
&Slot::context,
slot_locker);
cl_context context = get_something<cl_context>(platform, device, &Slot::context, slot_locker);
if(!context)
return NULL;
@@ -518,29 +434,19 @@ public:
}
/* see get_something comment */
static cl_program get_program(cl_platform_id platform,
cl_device_id device,
ProgramName program_name,
thread_scoped_lock& slot_locker)
static cl_program get_program(cl_platform_id platform, cl_device_id device, ProgramName program_name,
thread_scoped_lock &slot_locker)
{
cl_program program = NULL;
switch(program_name) {
case OCL_DEV_BASE_PROGRAM:
/* Get program related to OpenCLDeviceBase */
program = get_something<cl_program>(platform,
device,
&Slot::ocl_dev_base_program,
slot_locker);
break;
case OCL_DEV_MEGAKERNEL_PROGRAM:
/* Get program related to megakernel */
program = get_something<cl_program>(platform,
device,
&Slot::ocl_dev_megakernel_program,
slot_locker);
break;
default:
if(program_name == OCL_DEV_BASE_PROGRAM) {
/* Get program related to OpenCLDeviceBase */
program = get_something<cl_program>(platform, device, &Slot::ocl_dev_base_program, slot_locker);
}
else if(program_name == OCL_DEV_MEGAKERNEL_PROGRAM) {
/* Get program related to megakernel */
program = get_something<cl_program>(platform, device, &Slot::ocl_dev_megakernel_program, slot_locker);
} else {
assert(!"Invalid program name");
}
@@ -556,16 +462,10 @@ public:
}
/* see store_something comment */
static void store_context(cl_platform_id platform,
cl_device_id device,
cl_context context,
thread_scoped_lock& slot_locker)
static void store_context(cl_platform_id platform, cl_device_id device, cl_context context,
thread_scoped_lock &slot_locker)
{
store_something<cl_context>(platform,
device,
context,
&Slot::context,
slot_locker);
store_something<cl_context>(platform, device, context, &Slot::context, slot_locker);
/* increment reference count in OpenCL.
* The caller is going to release the object when done with it. */
@@ -575,41 +475,28 @@ public:
}
/* see store_something comment */
static void store_program(cl_platform_id platform,
cl_device_id device,
cl_program program,
ProgramName program_name,
thread_scoped_lock& slot_locker)
static void store_program(cl_platform_id platform, cl_device_id device, cl_program program, ProgramName program_name,
thread_scoped_lock &slot_locker)
{
switch (program_name) {
case OCL_DEV_BASE_PROGRAM:
store_something<cl_program>(platform,
device,
program,
&Slot::ocl_dev_base_program,
slot_locker);
break;
case OCL_DEV_MEGAKERNEL_PROGRAM:
store_something<cl_program>(platform,
device,
program,
&Slot::ocl_dev_megakernel_program,
slot_locker);
break;
default:
assert(!"Invalid program name\n");
return;
if(program_name == OCL_DEV_BASE_PROGRAM) {
store_something<cl_program>(platform, device, program, &Slot::ocl_dev_base_program, slot_locker);
}
else if(program_name == OCL_DEV_MEGAKERNEL_PROGRAM) {
store_something<cl_program>(platform, device, program, &Slot::ocl_dev_megakernel_program, slot_locker);
} else {
assert(!"Invalid program name\n");
return;
}
/* Increment reference count in OpenCL.
* The caller is going to release the object when done with it.
*/
/* increment reference count in OpenCL.
* The caller is going to release the object when done with it. */
cl_int ciErr = clRetainProgram(program);
assert(ciErr == CL_SUCCESS);
(void)ciErr;
}
/* Discard all cached contexts and programs. */
/* discard all cached contexts and programs
* the parameter is a temporary workaround. See OpenCLCache::~OpenCLCache */
static void flush()
{
OpenCLCache &self = global_instance();
@@ -723,10 +610,9 @@ public:
OpenCLPlatformDevice& platform_device = usable_devices[info.num];
cpPlatform = platform_device.platform_id;
cdDevice = platform_device.device_id;
platform_name = platform_device.platform_name;
VLOG(2) << "Creating new Cycles device for OpenCL platform "
<< platform_name << ", device "
<< platform_device.device_name << ".";
char name[256];
clGetPlatformInfo(cpPlatform, CL_PLATFORM_NAME, sizeof(name), &name, NULL);
platform_name = name;
{
/* try to use cached context */
@@ -936,109 +822,79 @@ public:
return md5.get_hex();
}
bool load_kernels(const DeviceRequestedFeatures& requested_features)
bool load_kernels(const DeviceRequestedFeatures& /*requested_features*/)
{
/* Verify if device was initialized. */
/* verify if device was initialized */
if(!device_initialized) {
fprintf(stderr, "OpenCL: failed to initialize device.\n");
return false;
}
/* Try to use cached kernel. */
/* try to use cached kernel */
thread_scoped_lock cache_locker;
cpProgram = load_cached_kernel(requested_features,
OpenCLCache::OCL_DEV_BASE_PROGRAM,
cache_locker);
cpProgram = OpenCLCache::get_program(cpPlatform, cdDevice, OpenCLCache::OCL_DEV_BASE_PROGRAM, cache_locker);
if(!cpProgram) {
VLOG(2) << "No cached OpenCL kernel.";
/* Verify we have right opencl version. */
/* verify we have right opencl version */
if(!opencl_version_check())
return false;
string build_flags = build_options_for_base_program(requested_features);
/* Calculate md5 hashes to detect changes. */
/* md5 hash to detect changes */
string kernel_path = path_get("kernel");
string kernel_md5 = path_files_md5_hash(kernel_path);
string device_md5 = device_md5_hash(build_flags);
string device_md5 = device_md5_hash();
/* Path to cached binary.
*
* TODO(sergey): Seems we could de-duplicate all this string_printf()
* calls with some utility function which will give file name for a
* given hashes..
*/
string clbin = string_printf("cycles_kernel_%s_%s.clbin",
device_md5.c_str(),
kernel_md5.c_str());
/* path to cached binary */
string clbin = string_printf("cycles_kernel_%s_%s.clbin", device_md5.c_str(), kernel_md5.c_str());
clbin = path_user_get(path_join("cache", clbin));
/* path to preprocessed source for debugging */
string clsrc, *debug_src = NULL;
if(opencl_kernel_use_debug()) {
clsrc = string_printf("cycles_kernel_%s_%s.cl",
device_md5.c_str(),
kernel_md5.c_str());
clsrc = string_printf("cycles_kernel_%s_%s.cl", device_md5.c_str(), kernel_md5.c_str());
clsrc = path_user_get(path_join("cache", clsrc));
debug_src = &clsrc;
}
/* If binary kernel exists already, try use it. */
if(path_exists(clbin) && load_binary(kernel_path,
clbin,
build_flags,
&cpProgram)) {
/* Kernel loaded from binary, nothing to do. */
VLOG(2) << "Loaded kernel from " << clbin << ".";
/* if exists already, try use it */
if(path_exists(clbin) && load_binary(kernel_path, clbin, "", &cpProgram)) {
/* kernel loaded from binary */
}
else {
VLOG(2) << "Kernel file " << clbin << " either doesn't exist or failed to be loaded by driver.";
string init_kernel_source = "#include \"kernels/opencl/kernel.cl\" // " + kernel_md5 + "\n";
/* If does not exist or loading binary failed, compile kernel. */
if(!compile_kernel(kernel_path,
init_kernel_source,
build_flags,
&cpProgram,
debug_src))
{
/* if does not exist or loading binary failed, compile kernel */
if(!compile_kernel(kernel_path, init_kernel_source, "", &cpProgram, debug_src))
return false;
}
/* Save binary for reuse. */
if(!save_binary(&cpProgram, clbin)) {
/* save binary for reuse */
if(!save_binary(&cpProgram, clbin))
return false;
}
}
/* Cache the program. */
store_cached_kernel(cpPlatform,
cdDevice,
cpProgram,
OpenCLCache::OCL_DEV_BASE_PROGRAM,
cache_locker);
}
else {
VLOG(2) << "Found cached OpenCL kernel.";
/* cache the program */
OpenCLCache::store_program(cpPlatform, cdDevice, cpProgram, OpenCLCache::OCL_DEV_BASE_PROGRAM, cache_locker);
}
/* Find kernels. */
#define FIND_KERNEL(kernel_var, kernel_name) \
do { \
kernel_var = clCreateKernel(cpProgram, "kernel_ocl_" kernel_name, &ciErr); \
if(opencl_error(ciErr)) \
return false; \
} while(0)
/* find kernels */
ckFilmConvertByteKernel = clCreateKernel(cpProgram, "kernel_ocl_convert_to_byte", &ciErr);
if(opencl_error(ciErr))
return false;
FIND_KERNEL(ckFilmConvertByteKernel, "convert_to_byte");
FIND_KERNEL(ckFilmConvertHalfFloatKernel, "convert_to_half_float");
FIND_KERNEL(ckShaderKernel, "shader");
FIND_KERNEL(ckBakeKernel, "bake");
ckFilmConvertHalfFloatKernel = clCreateKernel(cpProgram, "kernel_ocl_convert_to_half_float", &ciErr);
if(opencl_error(ciErr))
return false;
ckShaderKernel = clCreateKernel(cpProgram, "kernel_ocl_shader", &ciErr);
if(opencl_error(ciErr))
return false;
ckBakeKernel = clCreateKernel(cpProgram, "kernel_ocl_bake", &ciErr);
if(opencl_error(ciErr))
return false;
#undef FIND_KERNEL
return true;
}
@@ -1056,9 +912,9 @@ public:
}
if(ckFilmConvertByteKernel)
clReleaseKernel(ckFilmConvertByteKernel);
clReleaseKernel(ckFilmConvertByteKernel);
if(ckFilmConvertHalfFloatKernel)
clReleaseKernel(ckFilmConvertHalfFloatKernel);
clReleaseKernel(ckFilmConvertHalfFloatKernel);
if(ckShaderKernel)
clReleaseKernel(ckShaderKernel);
if(ckBakeKernel)
@@ -1085,22 +941,9 @@ public:
else
mem_flag = CL_MEM_READ_WRITE;
/* Zero-size allocation might be invoked by render, but not really
* supported by OpenCL. Using NULL as device pointer also doesn't really
* work for some reason, so for the time being we'll use special case
* will null_mem buffer.
*/
if(size != 0) {
mem.device_pointer = (device_ptr)clCreateBuffer(cxContext,
mem_flag,
size,
mem_ptr,
&ciErr);
opencl_assert_err(ciErr, "clCreateBuffer");
}
else {
mem.device_pointer = null_mem;
}
mem.device_pointer = (device_ptr)clCreateBuffer(cxContext, mem_flag, size, mem_ptr, &ciErr);
opencl_assert_err(ciErr, "clCreateBuffer");
stats.mem_alloc(size);
mem.device_size = size;
@@ -1110,31 +953,15 @@ public:
{
/* this is blocking */
size_t size = mem.memory_size();
if(size != 0){
opencl_assert(clEnqueueWriteBuffer(cqCommandQueue,
CL_MEM_PTR(mem.device_pointer),
CL_TRUE,
0,
size,
(void*)mem.data_pointer,
0,
NULL, NULL));
}
opencl_assert(clEnqueueWriteBuffer(cqCommandQueue, CL_MEM_PTR(mem.device_pointer), CL_TRUE, 0, size, (void*)mem.data_pointer, 0, NULL, NULL));
}
void mem_copy_from(device_memory& mem, int y, int w, int h, int elem)
{
size_t offset = elem*y*w;
size_t size = elem*w*h;
assert(size != 0);
opencl_assert(clEnqueueReadBuffer(cqCommandQueue,
CL_MEM_PTR(mem.device_pointer),
CL_TRUE,
offset,
size,
(uchar*)mem.data_pointer + offset,
0,
NULL, NULL));
opencl_assert(clEnqueueReadBuffer(cqCommandQueue, CL_MEM_PTR(mem.device_pointer), CL_TRUE, offset, size, (uchar*)mem.data_pointer + offset, 0, NULL, NULL));
}
void mem_zero(device_memory& mem)
@@ -1148,9 +975,7 @@ public:
void mem_free(device_memory& mem)
{
if(mem.device_pointer) {
if(mem.device_pointer != null_mem) {
opencl_assert(clReleaseMemObject(CL_MEM_PTR(mem.device_pointer)));
}
opencl_assert(clReleaseMemObject(CL_MEM_PTR(mem.device_pointer)));
mem.device_pointer = 0;
stats.mem_free(mem.device_size);
@@ -1180,7 +1005,7 @@ public:
void tex_alloc(const char *name,
device_memory& mem,
InterpolationType /*interpolation*/,
ExtensionType /*extension*/)
bool /*periodic*/)
{
VLOG(1) << "Texture allocate: " << name << ", " << mem.memory_size() << " bytes.";
mem_alloc(mem, MEM_READ_ONLY);
@@ -1378,6 +1203,7 @@ public:
virtual void thread_run(DeviceTask * /*task*/) = 0;
protected:
string kernel_build_options(const string *debug_src = NULL)
{
string build_options = " -cl-fast-relaxed-math ";
@@ -1567,49 +1393,8 @@ protected:
if(!requested_features.use_camera_motion) {
build_options += " -D__NO_CAMERA_MOTION__";
}
if(!requested_features.use_baking) {
build_options += " -D__NO_BAKING__";
}
return build_options;
}
/* ** Those guys are for workign around some compiler-specific bugs ** */
virtual cl_program load_cached_kernel(
const DeviceRequestedFeatures& /*requested_features*/,
OpenCLCache::ProgramName program_name,
thread_scoped_lock& cache_locker)
{
return OpenCLCache::get_program(cpPlatform,
cdDevice,
program_name,
cache_locker);
}
virtual void store_cached_kernel(cl_platform_id platform,
cl_device_id device,
cl_program program,
OpenCLCache::ProgramName program_name,
thread_scoped_lock& cache_locker)
{
OpenCLCache::store_program(platform,
device,
program,
program_name,
cache_locker);
}
virtual string build_options_for_base_program(
const DeviceRequestedFeatures& /*requested_features*/)
{
/* TODO(sergey): By default we compile all features, meaning
* mega kernel is not getting feature-based optimizations.
*
* Ideally we need always compile kernel with as less features
* enabed as possible to keep performance at it's max.
*/
return "";
}
};
class OpenCLDeviceMegaKernel : public OpenCLDeviceBase
@@ -3033,25 +2818,16 @@ public:
/* Macro for Enqueuing split kernels. */
#define GLUE(a, b) a ## b
#define ENQUEUE_SPLIT_KERNEL(kernelName, globalSize, localSize) \
{ \
ciErr = clEnqueueNDRangeKernel(cqCommandQueue, \
GLUE(ckPathTraceKernel_, \
kernelName), \
2, \
NULL, \
globalSize, \
localSize, \
0, \
NULL, \
NULL); \
opencl_assert_err(ciErr, "clEnqueueNDRangeKernel"); \
if(ciErr != CL_SUCCESS) { \
string message = string_printf("OpenCL error: %s in clEnqueueNDRangeKernel()", \
clewErrorString(ciErr)); \
opencl_error(message); \
return; \
} \
} (void) 0
opencl_assert(clEnqueueNDRangeKernel(cqCommandQueue, \
GLUE(ckPathTraceKernel_, \
kernelName), \
2, \
NULL, \
globalSize, \
localSize, \
0, \
NULL, \
NULL))
/* Enqueue ckPathTraceKernel_data_init kernel. */
ENQUEUE_SPLIT_KERNEL(data_init, global_size, local_size);
@@ -3549,39 +3325,12 @@ protected:
cl_mem mem_alloc(size_t bufsize, cl_mem_flags mem_flag = CL_MEM_READ_WRITE)
{
cl_mem ptr;
assert(bufsize != 0);
ptr = clCreateBuffer(cxContext, mem_flag, bufsize, NULL, &ciErr);
opencl_assert_err(ciErr, "clCreateBuffer");
if(opencl_error(ciErr)) {
assert(0);
}
return ptr;
}
/* ** Those guys are for workign around some compiler-specific bugs ** */
cl_program load_cached_kernel(
const DeviceRequestedFeatures& /*requested_features*/,
OpenCLCache::ProgramName /*program_name*/,
thread_scoped_lock /*cache_locker*/)
{
VLOG(2) << "Skip loading kernel from cache, "
<< "not supported by split kernel.";
return NULL;
}
void store_cached_kernel(cl_platform_id /*platform*/,
cl_device_id /*device*/,
cl_program /*program*/,
OpenCLCache::ProgramName /*program_name*/,
thread_scoped_lock& /*slot_locker*/)
{
VLOG(2) << "Skip storing kernel in cache, "
<< "not supported by split kernel.";
}
string build_options_for_base_program(
const DeviceRequestedFeatures& requested_features)
{
return build_options_from_requested_features(requested_features);
}
};
Device *device_opencl_create(DeviceInfo& info, Stats &stats, bool background)
@@ -3589,9 +3338,28 @@ Device *device_opencl_create(DeviceInfo& info, Stats &stats, bool background)
vector<OpenCLPlatformDevice> usable_devices;
opencl_get_usable_devices(&usable_devices);
assert(info.num < usable_devices.size());
const OpenCLPlatformDevice& platform_device = usable_devices[info.num];
const string& platform_name = platform_device.platform_name;
const cl_device_type device_type = platform_device.device_type;
OpenCLPlatformDevice& platform_device = usable_devices[info.num];
char name[256];
if(clGetPlatformInfo(platform_device.platform_id,
CL_PLATFORM_NAME,
sizeof(name),
&name,
NULL) != CL_SUCCESS)
{
VLOG(1) << "Failed to retrieve platform name, using mega kernel.";
return new OpenCLDeviceMegaKernel(info, stats, background);
}
string platform_name = name;
cl_device_type device_type;
if(clGetDeviceInfo(platform_device.device_id,
CL_DEVICE_TYPE,
sizeof(cl_device_type),
&device_type,
NULL) != CL_SUCCESS)
{
VLOG(1) << "Failed to retrieve device type, using mega kernel,";
return new OpenCLDeviceMegaKernel(info, stats, background);
}
if(opencl_kernel_use_split(platform_name, device_type)) {
VLOG(1) << "Using split kernel.";
return new OpenCLDeviceSplitKernel(info, stats, background);
@@ -3611,23 +3379,7 @@ bool device_opencl_init(void)
initialized = true;
if(opencl_device_type() != 0) {
int clew_result = clewInit();
if(clew_result == CLEW_SUCCESS) {
VLOG(1) << "CLEW initialization succeeded.";
result = true;
}
else {
VLOG(1) << "CLEW initialization failed: "
<< ((clew_result == CLEW_ERROR_ATEXIT_FAILED)
? "Error setting up atexit() handler"
: "Error opening the library");
}
}
else {
VLOG(1) << "Skip initializing CLEW, platform is force disabled.";
result = false;
}
result = clewInit() == CLEW_SUCCESS;
return result;
}
@@ -3639,13 +3391,43 @@ void device_opencl_info(vector<DeviceInfo>& devices)
/* Devices are numbered consecutively across platforms. */
int num_devices = 0;
foreach(OpenCLPlatformDevice& platform_device, usable_devices) {
const string& platform_name = platform_device.platform_name;
const cl_device_type device_type = platform_device.device_type;
const string& device_name = platform_device.device_name;
cl_platform_id platform_id = platform_device.platform_id;
cl_device_id device_id = platform_device.device_id;
/* We always increment the device number, so there;s 1:1 mapping from
* info.num to indexinside usable_devices vector.
*/
++num_devices;
char platform_name[256];
if(clGetPlatformInfo(platform_id,
CL_PLATFORM_NAME,
sizeof(platform_name),
&platform_name,
NULL) != CL_SUCCESS)
{
continue;
}
char device_name[1024] = "\0";
if(clGetDeviceInfo(device_id,
CL_DEVICE_NAME,
sizeof(device_name),
&device_name,
NULL) != CL_SUCCESS)
{
continue;
}
cl_device_type device_type;
if(clGetDeviceInfo(device_id,
CL_DEVICE_TYPE,
sizeof(cl_device_type),
&device_type,
NULL) != CL_SUCCESS)
{
continue;
}
DeviceInfo info;
info.type = DEVICE_OPENCL;
info.description = string_remove_trademark(string(device_name));
info.num = num_devices;
info.num = num_devices - 1;
info.id = string_printf("OPENCL_%d", info.num);
/* We don't know if it's used for display, but assume it is. */
info.display_device = true;
@@ -3654,15 +3436,11 @@ void device_opencl_info(vector<DeviceInfo>& devices)
info.use_split_kernel = opencl_kernel_use_split(platform_name,
device_type);
devices.push_back(info);
num_devices++;
}
}
string device_opencl_capabilities(void)
{
if(opencl_device_type() == 0) {
return "All OpenCL devices are forced to be OFF";
}
string result = "";
string error_msg = ""; /* Only used by opencl_assert(), but in the future
* it could also be nicely reported to the console.

View File

@@ -125,7 +125,6 @@ set(SRC_SVM_HEADERS
svm/svm_value.h
svm/svm_vector_transform.h
svm/svm_voronoi.h
svm/svm_voxel.h
svm/svm_wave.h
)
@@ -189,7 +188,7 @@ if(WITH_CYCLES_CUDA_BINARIES)
endif()
# CUDA version
execute_process(COMMAND ${CUDA_NVCC_EXECUTABLE} "--version" OUTPUT_VARIABLE NVCC_OUT)
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}")

View File

@@ -382,6 +382,10 @@ ccl_device float3 bsdf_microfacet_ggx_eval_transmit(const ShaderClosure *sc, con
float cosHO = dot(Ht, I);
float cosHI = dot(Ht, omega_in);
/* those situations makes chi+ terms in eq. 33, 34 be zero */
if(dot(Ht, N) <= 0.0f || cosHO * cosNO <= 0.0f || cosHI * cosNI <= 0.0f)
return make_float3(0.0f, 0.0f, 0.0f);
float D, G1o, G1i;
/* eq. 33: first we calculate D(m) with m=Ht: */
@@ -408,7 +412,7 @@ ccl_device float3 bsdf_microfacet_ggx_eval_transmit(const ShaderClosure *sc, con
* pdf = pm * (m_eta * m_eta) * fabsf(cosHI) / Ht2 */
float common = D * (m_eta * m_eta) / (cosNO * Ht2);
float out = G * fabsf(cosHI * cosHO) * common;
*pdf = G1o * fabsf(cosHO * cosHI) * common;
*pdf = G1o * cosHO * fabsf(cosHI) * common;
return make_float3(out, out, out);
}
@@ -731,6 +735,10 @@ ccl_device float3 bsdf_microfacet_beckmann_eval_transmit(const ShaderClosure *sc
float cosHO = dot(Ht, I);
float cosHI = dot(Ht, omega_in);
/* those situations makes chi+ terms in eq. 25, 27 be zero */
if(dot(Ht, N) <= 0.0f || cosHO * cosNO <= 0.0f || cosHI * cosNI <= 0.0f)
return make_float3(0.0f, 0.0f, 0.0f);
/* eq. 25: first we calculate D(m) with m=Ht: */
float alpha2 = alpha_x * alpha_y;
float cosThetaM = min(dot(N, Ht), 1.0f);
@@ -756,7 +764,7 @@ ccl_device float3 bsdf_microfacet_beckmann_eval_transmit(const ShaderClosure *sc
* pdf = pm * (m_eta * m_eta) * fabsf(cosHI) / Ht2 */
float common = D * (m_eta * m_eta) / (cosNO * Ht2);
float out = G * fabsf(cosHI * cosHO) * common;
*pdf = G1o * fabsf(cosHO * cosHI) * common;
*pdf = G1o * cosHO * fabsf(cosHI) * common;
return make_float3(out, out, out);
}

View File

@@ -58,9 +58,6 @@ ccl_device bool BVH_FUNCTION_FULL_NAME(QBVH)(KernelGlobals *kg,
Transform ob_tfm;
#endif
*num_hits = 0;
isect_array->t = tmax;
#ifndef __KERNEL_SSE41__
if(!isfinite(P.x)) {
return false;
@@ -71,6 +68,9 @@ ccl_device bool BVH_FUNCTION_FULL_NAME(QBVH)(KernelGlobals *kg,
int num_hits_in_instance = 0;
#endif
*num_hits = 0;
isect_array->t = tmax;
ssef tnear(0.0f), tfar(tmax);
sse3f idir4(ssef(idir.x), ssef(idir.y), ssef(idir.z));

View File

@@ -60,9 +60,6 @@ ccl_device uint BVH_FUNCTION_FULL_NAME(QBVH)(KernelGlobals *kg,
Transform ob_tfm;
#endif
uint num_hits = 0;
isect_array->t = tmax;
#ifndef __KERNEL_SSE41__
if(!isfinite(P.x)) {
return false;
@@ -73,6 +70,9 @@ ccl_device uint BVH_FUNCTION_FULL_NAME(QBVH)(KernelGlobals *kg,
int num_hits_in_instance = 0;
#endif
uint num_hits = 0;
isect_array->t = tmax;
ssef tnear(0.0f), tfar(isect_t);
sse3f idir4(ssef(idir.x), ssef(idir.y), ssef(idir.z));

View File

@@ -32,14 +32,7 @@ void *kernel_osl_memory(KernelGlobals *kg);
bool kernel_osl_use(KernelGlobals *kg);
void kernel_const_copy(KernelGlobals *kg, const char *name, void *host, size_t size);
void kernel_tex_copy(KernelGlobals *kg,
const char *name,
device_ptr mem,
size_t width,
size_t height,
size_t depth,
InterpolationType interpolation=INTERPOLATION_LINEAR,
ExtensionType extension = EXTENSION_REPEAT);
void kernel_tex_copy(KernelGlobals *kg, const char *name, device_ptr mem, size_t width, size_t height, size_t depth, InterpolationType interpolation=INTERPOLATION_LINEAR);
void kernel_cpu_path_trace(KernelGlobals *kg, float *buffer, unsigned int *rng_state,
int sample, int x, int y, int offset, int stride);

View File

@@ -43,30 +43,7 @@ ccl_device void camera_sample_perspective(KernelGlobals *kg, float raster_x, flo
{
/* create ray form raster position */
Transform rastertocamera = kernel_data.cam.rastertocamera;
float3 raster = make_float3(raster_x, raster_y, 0.0f);
float3 Pcamera = transform_perspective(&rastertocamera, raster);
#ifdef __CAMERA_MOTION__
if(kernel_data.cam.have_perspective_motion) {
/* TODO(sergey): Currently we interpolate projected coordinate which
* gives nice looking result and which is simple, but is in fact a bit
* different comparing to constructing projective matrix from an
* interpolated field of view.
*/
if(ray->time < 0.5f) {
Transform rastertocamera_pre = kernel_data.cam.perspective_motion.pre;
float3 Pcamera_pre =
transform_perspective(&rastertocamera_pre, raster);
Pcamera = interp(Pcamera_pre, Pcamera, ray->time * 2.0f);
}
else {
Transform rastertocamera_post = kernel_data.cam.perspective_motion.post;
float3 Pcamera_post =
transform_perspective(&rastertocamera_post, raster);
Pcamera = interp(Pcamera, Pcamera_post, (ray->time - 0.5f) * 2.0f);
}
}
#endif
float3 Pcamera = transform_perspective(&rastertocamera, make_float3(raster_x, raster_y, 0.0f));
ray->P = make_float3(0.0f, 0.0f, 0.0f);
ray->D = Pcamera;
@@ -267,14 +244,11 @@ ccl_device void camera_sample_panorama(KernelGlobals *kg, float raster_x, float
/* ray differential */
ray->dP = differential3_zero();
Pcamera = transform_perspective(&rastertocamera, make_float3(raster_x, raster_y, 0.0f));
float3 Ddiff = normalize(transform_direction(&cameratoworld, panorama_to_direction(kg, Pcamera.x, Pcamera.y)));
Pcamera = transform_perspective(&rastertocamera, make_float3(raster_x + 1.0f, raster_y, 0.0f));
ray->dD.dx = normalize(transform_direction(&cameratoworld, panorama_to_direction(kg, Pcamera.x, Pcamera.y))) - Ddiff;
ray->dD.dx = normalize(transform_direction(&cameratoworld, panorama_to_direction(kg, Pcamera.x, Pcamera.y))) - ray->D;
Pcamera = transform_perspective(&rastertocamera, make_float3(raster_x, raster_y + 1.0f, 0.0f));
ray->dD.dy = normalize(transform_direction(&cameratoworld, panorama_to_direction(kg, Pcamera.x, Pcamera.y))) - Ddiff;
ray->dD.dy = normalize(transform_direction(&cameratoworld, panorama_to_direction(kg, Pcamera.x, Pcamera.y))) - ray->D;
#endif
}

View File

@@ -128,7 +128,7 @@ template<typename T> struct texture_image {
return x - (float)i;
}
ccl_always_inline float4 interp(float x, float y)
ccl_always_inline float4 interp(float x, float y, bool periodic = true)
{
if(UNLIKELY(!data))
return make_float4(0.0f, 0.0f, 0.0f, 0.0f);
@@ -138,20 +138,14 @@ template<typename T> struct texture_image {
if(interpolation == INTERPOLATION_CLOSEST) {
frac(x*(float)width, &ix);
frac(y*(float)height, &iy);
switch(extension) {
case EXTENSION_REPEAT:
ix = wrap_periodic(ix, width);
iy = wrap_periodic(iy, height);
break;
case EXTENSION_CLIP:
if (x < 0.0f || y < 0.0f || x >= width || y >= height) {
return make_float4(0.0f, 0.0f, 0.0f, 0.0f);
}
/* Fall through. */
case EXTENSION_EXTEND:
ix = wrap_clamp(ix, width);
iy = wrap_clamp(iy, height);
break;
if(periodic) {
ix = wrap_periodic(ix, width);
iy = wrap_periodic(iy, height);
}
else {
ix = wrap_clamp(ix, width);
iy = wrap_clamp(iy, height);
}
return read(data[ix + iy*width]);
}
@@ -159,26 +153,19 @@ template<typename T> struct texture_image {
float tx = frac(x*(float)width - 0.5f, &ix);
float ty = frac(y*(float)height - 0.5f, &iy);
switch(extension) {
case EXTENSION_REPEAT:
ix = wrap_periodic(ix, width);
iy = wrap_periodic(iy, height);
if(periodic) {
ix = wrap_periodic(ix, width);
iy = wrap_periodic(iy, height);
nix = wrap_periodic(ix+1, width);
niy = wrap_periodic(iy+1, height);
break;
case EXTENSION_CLIP:
if (x < 0.0f || y < 0.0f || x >= width || y >= height) {
return make_float4(0.0f, 0.0f, 0.0f, 0.0f);
}
/* Fall through. */
case EXTENSION_EXTEND:
ix = wrap_clamp(ix, width);
iy = wrap_clamp(iy, height);
nix = wrap_periodic(ix+1, width);
niy = wrap_periodic(iy+1, height);
}
else {
ix = wrap_clamp(ix, width);
iy = wrap_clamp(iy, height);
nix = wrap_clamp(ix+1, width);
niy = wrap_clamp(iy+1, height);
break;
nix = wrap_clamp(ix+1, width);
niy = wrap_clamp(iy+1, height);
}
float4 r = (1.0f - ty)*(1.0f - tx)*read(data[ix + iy*width]);
@@ -189,44 +176,36 @@ template<typename T> struct texture_image {
return r;
}
else {
/* Bicubic b-spline interpolation. */
/* Tricubic b-spline interpolation. */
const float tx = frac(x*(float)width - 0.5f, &ix);
const float ty = frac(y*(float)height - 0.5f, &iy);
int pix, piy, nnix, nniy;
switch(extension) {
case EXTENSION_REPEAT:
ix = wrap_periodic(ix, width);
iy = wrap_periodic(iy, height);
if(periodic) {
ix = wrap_periodic(ix, width);
iy = wrap_periodic(iy, height);
pix = wrap_periodic(ix-1, width);
piy = wrap_periodic(iy-1, height);
pix = wrap_periodic(ix-1, width);
piy = wrap_periodic(iy-1, height);
nix = wrap_periodic(ix+1, width);
niy = wrap_periodic(iy+1, height);
nix = wrap_periodic(ix+1, width);
niy = wrap_periodic(iy+1, height);
nnix = wrap_periodic(ix+2, width);
nniy = wrap_periodic(iy+2, height);
break;
case EXTENSION_CLIP:
if (x < 0.0f || y < 0.0f || x >= width || y >= height) {
return make_float4(0.0f, 0.0f, 0.0f, 0.0f);
}
/* Fall through. */
case EXTENSION_EXTEND:
ix = wrap_clamp(ix, width);
iy = wrap_clamp(iy, height);
pix = wrap_clamp(ix-1, width);
piy = wrap_clamp(iy-1, height);
nix = wrap_clamp(ix+1, width);
niy = wrap_clamp(iy+1, height);
nnix = wrap_clamp(ix+2, width);
nniy = wrap_clamp(iy+2, height);
break;
nnix = wrap_periodic(ix+2, width);
nniy = wrap_periodic(iy+2, height);
}
else {
ix = wrap_clamp(ix, width);
iy = wrap_clamp(iy, height);
pix = wrap_clamp(ix-1, width);
piy = wrap_clamp(iy-1, height);
nix = wrap_clamp(ix+1, width);
niy = wrap_clamp(iy+1, height);
nnix = wrap_clamp(ix+2, width);
nniy = wrap_clamp(iy+2, height);
}
const int xc[4] = {pix, ix, nix, nnix};
const int yc[4] = {width * piy,
width * iy,
@@ -254,13 +233,14 @@ template<typename T> struct texture_image {
}
}
ccl_always_inline float4 interp_3d(float x, float y, float z)
ccl_always_inline float4 interp_3d(float x, float y, float z, bool periodic = false)
{
return interp_3d_ex(x, y, z, interpolation);
return interp_3d_ex(x, y, z, interpolation, periodic);
}
ccl_always_inline float4 interp_3d_ex(float x, float y, float z,
int interpolation = INTERPOLATION_LINEAR)
int interpolation = INTERPOLATION_LINEAR,
bool periodic = false)
{
if(UNLIKELY(!data))
return make_float4(0.0f, 0.0f, 0.0f, 0.0f);
@@ -272,22 +252,15 @@ template<typename T> struct texture_image {
frac(y*(float)height, &iy);
frac(z*(float)depth, &iz);
switch(extension) {
case EXTENSION_REPEAT:
ix = wrap_periodic(ix, width);
iy = wrap_periodic(iy, height);
iz = wrap_periodic(iz, depth);
break;
case EXTENSION_CLIP:
if (x < 0.0f || y < 0.0f || x >= width || y >= height) {
return make_float4(0.0f, 0.0f, 0.0f, 0.0f);
}
/* Fall through. */
case EXTENSION_EXTEND:
ix = wrap_clamp(ix, width);
iy = wrap_clamp(iy, height);
iz = wrap_clamp(iz, depth);
break;
if(periodic) {
ix = wrap_periodic(ix, width);
iy = wrap_periodic(iy, height);
iz = wrap_periodic(iz, depth);
}
else {
ix = wrap_clamp(ix, width);
iy = wrap_clamp(iy, height);
iz = wrap_clamp(iz, depth);
}
return read(data[ix + iy*width + iz*width*height]);
@@ -297,30 +270,23 @@ template<typename T> struct texture_image {
float ty = frac(y*(float)height - 0.5f, &iy);
float tz = frac(z*(float)depth - 0.5f, &iz);
switch(extension) {
case EXTENSION_REPEAT:
ix = wrap_periodic(ix, width);
iy = wrap_periodic(iy, height);
iz = wrap_periodic(iz, depth);
if(periodic) {
ix = wrap_periodic(ix, width);
iy = wrap_periodic(iy, height);
iz = wrap_periodic(iz, depth);
nix = wrap_periodic(ix+1, width);
niy = wrap_periodic(iy+1, height);
niz = wrap_periodic(iz+1, depth);
break;
case EXTENSION_CLIP:
if (x < 0.0f || y < 0.0f || x >= width || y >= height) {
return make_float4(0.0f, 0.0f, 0.0f, 0.0f);
}
/* Fall through. */
case EXTENSION_EXTEND:
ix = wrap_clamp(ix, width);
iy = wrap_clamp(iy, height);
iz = wrap_clamp(iz, depth);
nix = wrap_periodic(ix+1, width);
niy = wrap_periodic(iy+1, height);
niz = wrap_periodic(iz+1, depth);
}
else {
ix = wrap_clamp(ix, width);
iy = wrap_clamp(iy, height);
iz = wrap_clamp(iz, depth);
nix = wrap_clamp(ix+1, width);
niy = wrap_clamp(iy+1, height);
niz = wrap_clamp(iz+1, depth);
break;
nix = wrap_clamp(ix+1, width);
niy = wrap_clamp(iy+1, height);
niz = wrap_clamp(iz+1, depth);
}
float4 r;
@@ -344,46 +310,39 @@ template<typename T> struct texture_image {
const float tz = frac(z*(float)depth - 0.5f, &iz);
int pix, piy, piz, nnix, nniy, nniz;
switch(extension) {
case EXTENSION_REPEAT:
ix = wrap_periodic(ix, width);
iy = wrap_periodic(iy, height);
iz = wrap_periodic(iz, depth);
if(periodic) {
ix = wrap_periodic(ix, width);
iy = wrap_periodic(iy, height);
iz = wrap_periodic(iz, depth);
pix = wrap_periodic(ix-1, width);
piy = wrap_periodic(iy-1, height);
piz = wrap_periodic(iz-1, depth);
pix = wrap_periodic(ix-1, width);
piy = wrap_periodic(iy-1, height);
piz = wrap_periodic(iz-1, depth);
nix = wrap_periodic(ix+1, width);
niy = wrap_periodic(iy+1, height);
niz = wrap_periodic(iz+1, depth);
nix = wrap_periodic(ix+1, width);
niy = wrap_periodic(iy+1, height);
niz = wrap_periodic(iz+1, depth);
nnix = wrap_periodic(ix+2, width);
nniy = wrap_periodic(iy+2, height);
nniz = wrap_periodic(iz+2, depth);
break;
case EXTENSION_CLIP:
if (x < 0.0f || y < 0.0f || x >= width || y >= height) {
return make_float4(0.0f, 0.0f, 0.0f, 0.0f);
}
/* Fall through. */
case EXTENSION_EXTEND:
ix = wrap_clamp(ix, width);
iy = wrap_clamp(iy, height);
iz = wrap_clamp(iz, depth);
nnix = wrap_periodic(ix+2, width);
nniy = wrap_periodic(iy+2, height);
nniz = wrap_periodic(iz+2, depth);
}
else {
ix = wrap_clamp(ix, width);
iy = wrap_clamp(iy, height);
iz = wrap_clamp(iz, depth);
pix = wrap_clamp(ix-1, width);
piy = wrap_clamp(iy-1, height);
piz = wrap_clamp(iz-1, depth);
pix = wrap_clamp(ix-1, width);
piy = wrap_clamp(iy-1, height);
piz = wrap_clamp(iz-1, depth);
nix = wrap_clamp(ix+1, width);
niy = wrap_clamp(iy+1, height);
niz = wrap_clamp(iz+1, depth);
nix = wrap_clamp(ix+1, width);
niy = wrap_clamp(iy+1, height);
niz = wrap_clamp(iz+1, depth);
nnix = wrap_clamp(ix+2, width);
nniy = wrap_clamp(iy+2, height);
nniz = wrap_clamp(iz+2, depth);
break;
nnix = wrap_clamp(ix+2, width);
nniy = wrap_clamp(iy+2, height);
nniz = wrap_clamp(iz+2, depth);
}
const int xc[4] = {pix, ix, nix, nnix};
@@ -434,7 +393,6 @@ template<typename T> struct texture_image {
T *data;
int interpolation;
ExtensionType extension;
int width, height, depth;
#undef SET_CUBIC_SPLINE_WEIGHTS
};

View File

@@ -728,15 +728,15 @@ ccl_device bool lamp_light_eval(KernelGlobals *kg, int lamp, float3 P, float3 D,
if(dot(D, Ng) >= 0.0f)
return false;
float3 light_P = make_float3(data0.y, data0.z, data0.w);
ls->P = make_float3(data0.y, data0.z, data0.w);
if(!ray_quad_intersect(P, D, t,
light_P, axisu, axisv, &ls->P, &ls->t))
ls->P, axisu, axisv, &ls->P, &ls->t))
return false;
ls->D = D;
ls->Ng = Ng;
ls->pdf = area_light_sample(P, &light_P, axisu, axisv, 0, 0, false);
ls->pdf = area_light_sample(P, &ls->P, axisu, axisv, 0, 0, false);
ls->eval_fac = 0.25f*invarea;
}
else

View File

@@ -27,14 +27,15 @@
/*
* Enqueue ray index into the queue
*/
ccl_device void enqueue_ray_index(
int ray_index, /* Ray index to be enqueued. */
int queue_number, /* Queue in which the ray index should be enqueued. */
ccl_global int *queues, /* Buffer of all queues. */
int queue_size, /* Size of each queue. */
ccl_global int *queue_index) /* Array of size num_queues; Used for atomic increment. */
ccl_device void enqueue_ray_index (
int ray_index, /* Ray index to be enqueued */
int queue_number, /* Queue in which the ray index should be enqueued*/
ccl_global int *queues, /* Buffer of all queues */
int queue_size, /* Size of each queue */
ccl_global int *queue_index /* Array of size num_queues; Used for atomic increment */
)
{
/* This thread's queue index. */
/* This thread's queue index */
int my_queue_index = atomic_inc(&queue_index[queue_number]) + (queue_number * queue_size);
queues[my_queue_index] = ray_index;
}
@@ -46,48 +47,52 @@ ccl_device void enqueue_ray_index(
* i.e All ray's in the queue has been successfully allocated and there
* is no more ray to allocate to other threads.
*/
ccl_device int get_ray_index(
int thread_index, /* Global thread index. */
int queue_number, /* Queue to operate on. */
ccl_global int *queues, /* Buffer of all queues. */
int queuesize, /* Size of a queue. */
int empty_queue) /* Empty the queue slot as soon as we fetch the ray index. */
ccl_device int get_ray_index (
int thread_index, /* Global thread index */
int queue_number, /* Queue to operate on */
ccl_global int *queues, /* Buffer of all queues */
int queuesize, /* Size of a queue */
int empty_queue /* Empty the queue slot as soon as we fetch the ray index */
)
{
int ray_index = queues[queue_number * queuesize + thread_index];
if(empty_queue && ray_index != QUEUE_EMPTY_SLOT) {
queues[queue_number * queuesize + thread_index] = QUEUE_EMPTY_SLOT;
}
return ray_index;
}
/* The following functions are to realize Local memory variant of enqueue ray index function. */
/* The following functions are to realize Local memory variant of enqueue ray index function */
/* All threads should call this function. */
/* All threads should call this function */
ccl_device void enqueue_ray_index_local(
int ray_index, /* Ray index to enqueue. */
int queue_number, /* Queue in which to enqueue ray index. */
char enqueue_flag, /* True for threads whose ray index has to be enqueued. */
int queuesize, /* queue size. */
ccl_local unsigned int *local_queue_atomics, /* To to local queue atomics. */
ccl_global int *Queue_data, /* Queues. */
ccl_global int *Queue_index) /* To do global queue atomics. */
int ray_index, /* Ray index to enqueue*/
int queue_number, /* Queue in which to enqueue ray index */
char enqueue_flag, /* True for threads whose ray index has to be enqueued */
int queuesize, /* queue size */
ccl_local unsigned int *local_queue_atomics, /* To to local queue atomics */
ccl_global int *Queue_data, /* Queues */
ccl_global int *Queue_index /* To do global queue atomics */
)
{
int lidx = get_local_id(1) * get_local_size(0) + get_local_id(0);
/* Get local queue id .*/
/* Get local queue id */
unsigned int lqidx;
if(enqueue_flag) {
lqidx = atomic_inc(local_queue_atomics);
}
barrier(CLK_LOCAL_MEM_FENCE);
/* Get global queue offset. */
/* Get global queue offset */
if(lidx == 0) {
*local_queue_atomics = atomic_add(&Queue_index[queue_number], *local_queue_atomics);
}
barrier(CLK_LOCAL_MEM_FENCE);
/* Get global queue index and enqueue ray. */
/* Get global queue index and enqueue ray */
if(enqueue_flag) {
unsigned int my_gqidx = queue_number * queuesize + (*local_queue_atomics) + lqidx;
Queue_data[my_gqidx] = ray_index;
@@ -95,28 +100,30 @@ ccl_device void enqueue_ray_index_local(
}
ccl_device unsigned int get_local_queue_index(
int queue_number, /* Queue in which to enqueue the ray; -1 if no queue */
ccl_local unsigned int *local_queue_atomics)
int queue_number, /* Queue in which to enqueue the ray; -1 if no queue */
ccl_local unsigned int *local_queue_atomics
)
{
int my_lqidx = atomic_inc(&local_queue_atomics[queue_number]);
return my_lqidx;
}
ccl_device unsigned int get_global_per_queue_offset(
int queue_number,
ccl_local unsigned int *local_queue_atomics,
ccl_global int* global_queue_atomics)
int queue_number,
ccl_local unsigned int *local_queue_atomics,
ccl_global int* global_queue_atomics
)
{
unsigned int queue_offset = atomic_add(&global_queue_atomics[queue_number],
local_queue_atomics[queue_number]);
unsigned int queue_offset = atomic_add((&global_queue_atomics[queue_number]), local_queue_atomics[queue_number]);
return queue_offset;
}
ccl_device unsigned int get_global_queue_index(
int queue_number,
int queuesize,
unsigned int lqidx,
ccl_local unsigned int * global_per_queue_offset)
int queue_number,
int queuesize,
unsigned int lqidx,
ccl_local unsigned int * global_per_queue_offset
)
{
int my_gqidx = queuesize * queue_number + lqidx + global_per_queue_offset[queue_number];
return my_gqidx;

View File

@@ -459,7 +459,7 @@ ccl_device void shader_merge_closures(ShaderData *sd)
continue;
#endif
if(!(sci->type == scj->type && sci->data0 == scj->data0 && sci->data1 == scj->data1 && sci->data2 == scj->data2))
if(!(sci->type == scj->type && sci->data0 == scj->data0 && sci->data1 == scj->data1))
continue;
if(CLOSURE_IS_BSDF_OR_BSSRDF(sci->type)) {

View File

@@ -105,14 +105,7 @@ CCL_NAMESPACE_BEGIN
#ifdef __KERNEL_OPENCL_APPLE__
# define __KERNEL_SHADING__
# define __KERNEL_ADV_SHADING__
/* TODO(sergey): Currently experimental section is ignored here,
* this is because megakernel in device_opencl does not support
* custom cflags depending on the scene features.
*/
# ifdef __KERNEL_EXPERIMENTAL__
# define __CMJ__
# endif
//#define __KERNEL_ADV_SHADING__
#endif
#ifdef __KERNEL_OPENCL_AMD__
@@ -720,6 +713,7 @@ typedef struct PathState {
/* random number generator state */
int rng_offset; /* dimension offset */
int rng_offset_bsdf; /* dimension offset for picking bsdf */
int sample; /* path sample number */
int num_samples; /* total number of times this path will be sampled */
@@ -777,7 +771,7 @@ typedef struct KernelCamera {
/* motion blur */
float shuttertime;
int have_motion, have_perspective_motion;
int have_motion;
/* clipping */
float nearclip;
@@ -795,6 +789,7 @@ typedef struct KernelCamera {
float inv_aperture_ratio;
int is_inside_volume;
int pad2;
/* more matrices */
Transform screentoworld;
@@ -808,11 +803,6 @@ typedef struct KernelCamera {
Transform worldtocamera;
MotionTransform motion;
/* Denotes changes in the projective matrix, namely in rastertocamera.
* Used for camera zoom motion blur,
*/
PerspectiveMotionTransform perspective_motion;
} KernelCamera;
typedef struct KernelFilm {
@@ -1025,19 +1015,16 @@ typedef ccl_addr_space struct DebugData {
/* Queue names */
enum QueueNumber {
QUEUE_ACTIVE_AND_REGENERATED_RAYS = 0, /* All active rays and regenerated rays are enqueued here. */
QUEUE_HITBG_BUFF_UPDATE_TOREGEN_RAYS = 1, /* All
* 1. Background-hit rays,
* 2. Rays that has exited path-iteration but needs to update output buffer
* 3. Rays to be regenerated
* are enqueued here.
*/
QUEUE_SHADOW_RAY_CAST_AO_RAYS = 2, /* All rays for which a shadow ray should be cast to determine radiance
* contribution for AO are enqueued here.
*/
QUEUE_SHADOW_RAY_CAST_DL_RAYS = 3, /* All rays for which a shadow ray should be cast to determine radiance
* contributuin for direct lighting are enqueued here.
*/
QUEUE_ACTIVE_AND_REGENERATED_RAYS, /* All active rays and regenerated rays are enqueued here */
QUEUE_HITBG_BUFF_UPDATE_TOREGEN_RAYS, /* All
* 1.Background-hit rays,
* 2.Rays that has exited path-iteration but needs to update output buffer
* 3.Rays to be regenerated
* are enqueued here */
QUEUE_SHADOW_RAY_CAST_AO_RAYS, /* All rays for which a shadow ray should be cast to determine radiance
contribution for AO are enqueued here */
QUEUE_SHADOW_RAY_CAST_DL_RAYS, /* All rays for which a shadow ray should be cast to determine radiance
contributuin for direct lighting are enqueued here */
};
/* We use RAY_STATE_MASK to get ray_state (enums 0 to 5) */

View File

@@ -578,7 +578,7 @@ ccl_device_noinline VolumeIntegrateResult kernel_volume_integrate(KernelGlobals
/* Decoupled Volume Sampling
*
* VolumeSegment is list of coefficients and transmittance stored at all steps
* through a volume. This can then later be used for decoupled sampling as in:
* through a volume. This can then latter be used for decoupled sampling as in:
* "Importance Sampling Techniques for Path Tracing in Participating Media"
*
* On the GPU this is only supported (but currently not enabled)

View File

@@ -38,14 +38,7 @@ void kernel_const_copy(KernelGlobals *kg, const char *name, void *host, size_t s
assert(0);
}
void kernel_tex_copy(KernelGlobals *kg,
const char *name,
device_ptr mem,
size_t width,
size_t height,
size_t depth,
InterpolationType interpolation,
ExtensionType extension)
void kernel_tex_copy(KernelGlobals *kg, const char *name, device_ptr mem, size_t width, size_t height, size_t depth, InterpolationType interpolation)
{
if(0) {
}
@@ -71,7 +64,6 @@ void kernel_tex_copy(KernelGlobals *kg,
tex->data = (float4*)mem;
tex->dimensions_set(width, height, depth);
tex->interpolation = interpolation;
tex->extension = extension;
}
}
else if(strstr(name, "__tex_image")) {
@@ -87,7 +79,6 @@ void kernel_tex_copy(KernelGlobals *kg,
tex->data = (uchar4*)mem;
tex->dimensions_set(width, height, depth);
tex->interpolation = interpolation;
tex->extension = extension;
}
}
else

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