From 26d7d995dbef20040664372a836d166b0a638ccb Mon Sep 17 00:00:00 2001 From: lazydodo Date: Wed, 28 Sep 2016 17:19:16 -0600 Subject: [PATCH 01/25] Fix Windows mouse wheel scroll speed In Windows, event dispatching code is throwing out the wheel scroll count value. Despite of how many fast you move the wheel, it only make one-notch scroll event. This patch convert wheel event to multiple 1-notch wheel events. This also correct the handling of smooth scroll mouse wheel (which can report smaller than 1-notch wheel movement) by accumulating the small wheel delta values. Reviewers: djnz, shadowrom, elubie, #platform:_windows, sergey, juicyfruit, brecht Reviewed By: shadowrom, elubie, #platform:_windows, brecht Subscribers: dingto, elubie, brachi, brecht Differential Revision: https://developer.blender.org/D143 --- intern/ghost/intern/GHOST_SystemWin32.cpp | 40 +++++++++++++---------- intern/ghost/intern/GHOST_SystemWin32.h | 7 ++-- 2 files changed, 27 insertions(+), 20 deletions(-) diff --git a/intern/ghost/intern/GHOST_SystemWin32.cpp b/intern/ghost/intern/GHOST_SystemWin32.cpp index 60e7815ccbb..e43634508b7 100644 --- a/intern/ghost/intern/GHOST_SystemWin32.cpp +++ b/intern/ghost/intern/GHOST_SystemWin32.cpp @@ -712,18 +712,26 @@ GHOST_EventCursor *GHOST_SystemWin32::processCursorEvent(GHOST_TEventType type, } -GHOST_EventWheel *GHOST_SystemWin32::processWheelEvent(GHOST_WindowWin32 *window, WPARAM wParam, LPARAM lParam) +void GHOST_SystemWin32::processWheelEvent(GHOST_WindowWin32 *window, WPARAM wParam, LPARAM lParam) { - // short fwKeys = LOWORD(wParam); // key flags - int zDelta = (short) HIWORD(wParam); // wheel rotation - - // zDelta /= WHEEL_DELTA; - // temporary fix below: microsoft now has added more precision, making the above division not work - zDelta = (zDelta <= 0) ? -1 : 1; + GHOST_SystemWin32 *system = (GHOST_SystemWin32 *)getSystem(); - // short xPos = (short) LOWORD(lParam); // horizontal position of pointer - // short yPos = (short) HIWORD(lParam); // vertical position of pointer - return new GHOST_EventWheel(getSystem()->getMilliSeconds(), window, zDelta); + int acc = system->m_wheelDeltaAccum; + int delta = GET_WHEEL_DELTA_WPARAM(wParam); + + if (acc * delta < 0) { + // scroll direction reversed. + acc = 0; + } + acc += delta; + int direction = (acc >= 0) ? 1 : -1; + acc = abs(acc); + + while (acc >= WHEEL_DELTA) { + system->pushEvent(new GHOST_EventWheel(system->getMilliSeconds(), window, direction)); + acc -= WHEEL_DELTA; + } + system->m_wheelDeltaAccum = acc * direction; } @@ -1137,14 +1145,9 @@ LRESULT WINAPI GHOST_SystemWin32::s_wndProc(HWND hwnd, UINT msg, WPARAM wParam, POINT mouse_pos = {GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam)}; HWND mouse_hwnd = ChildWindowFromPoint(HWND_DESKTOP, mouse_pos); GHOST_WindowWin32 *mouse_window = (GHOST_WindowWin32 *)::GetWindowLongPtr(mouse_hwnd, GWLP_USERDATA); - if (mouse_window != NULL) { - event = processWheelEvent(mouse_window, wParam, lParam); - } - else { - /* Happens when mouse is not over any of blender's windows. */ - event = processWheelEvent(window, wParam, lParam); - } - + + processWheelEvent(mouse_window ? mouse_window : window , wParam, lParam); + eventHandled = true; #ifdef BROKEN_PEEK_TOUCHPAD PostMessage(hwnd, WM_USER, 0, 0); #endif @@ -1203,6 +1206,7 @@ LRESULT WINAPI GHOST_SystemWin32::s_wndProc(HWND hwnd, UINT msg, WPARAM wParam, GHOST_ModifierKeys modifiers; modifiers.clear(); system->storeModifierKeys(modifiers); + system->m_wheelDeltaAccum = 0; event = processWindowEvent(LOWORD(wParam) ? GHOST_kEventWindowActivate : GHOST_kEventWindowDeactivate, window); /* WARNING: Let DefWindowProc handle WM_ACTIVATE, otherwise WM_MOUSEWHEEL * will not be dispatched to OUR active window if we minimize one of OUR windows. */ diff --git a/intern/ghost/intern/GHOST_SystemWin32.h b/intern/ghost/intern/GHOST_SystemWin32.h index 3085fde610b..d534a300b35 100644 --- a/intern/ghost/intern/GHOST_SystemWin32.h +++ b/intern/ghost/intern/GHOST_SystemWin32.h @@ -264,12 +264,12 @@ protected: static GHOST_EventCursor *processCursorEvent(GHOST_TEventType type, GHOST_WindowWin32 *window); /** - * Creates a mouse wheel event. + * Handles a mouse wheel event. * \param window The window receiving the event (the active window). * \param wParam The wParam from the wndproc * \param lParam The lParam from the wndproc */ - static GHOST_EventWheel *processWheelEvent(GHOST_WindowWin32 *window, WPARAM wParam, LPARAM lParam); + static void processWheelEvent(GHOST_WindowWin32 *window, WPARAM wParam, LPARAM lParam); /** * Creates a key event and updates the key data stored locally (m_modifierKeys). @@ -376,6 +376,9 @@ protected: /** Console status */ int m_consoleStatus; + + /** Wheel delta accumulator **/ + int m_wheelDeltaAccum; }; inline void GHOST_SystemWin32::retrieveModifierKeys(GHOST_ModifierKeys& keys) const From f1de438bba0fd6b525ea04d094b8a08737144e82 Mon Sep 17 00:00:00 2001 From: lazydodo Date: Wed, 28 Sep 2016 17:27:35 -0600 Subject: [PATCH 02/25] Revert "[Windows/MSVC] Blosc doesn't require debug libraries." turns out it's a C++ lib now-days and it *DOES* require debug libs. This reverts commit bde5eb8b6303d8d92b7c41d4a3f041bbb73c162d. --- build_files/cmake/platform/platform_win32_msvc.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build_files/cmake/platform/platform_win32_msvc.cmake b/build_files/cmake/platform/platform_win32_msvc.cmake index 961cada037e..5efda52b2c5 100644 --- a/build_files/cmake/platform/platform_win32_msvc.cmake +++ b/build_files/cmake/platform/platform_win32_msvc.cmake @@ -414,7 +414,7 @@ if(WITH_OPENCOLORIO) endif() if(WITH_OPENVDB) - set(BLOSC_LIBRARIES ${LIBDIR}/blosc/lib/libblosc.lib ) + set(BLOSC_LIBRARIES optimized ${LIBDIR}/blosc/lib/libblosc.lib debug ${LIBDIR}/blosc/lib/libblosc_d.lib) set(TBB_LIBRARIES optimized ${LIBDIR}/tbb/lib/tbb.lib debug ${LIBDIR}/tbb/lib/tbb_debug.lib) set(TBB_INCLUDE_DIR ${LIBDIR}/tbb/include) set(OPENVDB ${LIBDIR}/openvdb) From 78c380d3b84d53bf099b49571f0df67bea95bce2 Mon Sep 17 00:00:00 2001 From: lazydodo Date: Wed, 28 Sep 2016 19:57:25 -0600 Subject: [PATCH 03/25] [MSVC] make.bat updates. - The build folder name used to be depended on the order of the parameters, this is now normalized to "build_windows_[Release/Full/Lite/Headless/Cycles/Bpy]_[x86/x64]_vc[12/14]_[Release/Debug]" regardless of the order of the parameters. -Use CUDA8 for all kernels when building the release convenience target with visual studio 2015 --- make.bat | 70 ++++++++++++++++++++++++++++++-------------------------- 1 file changed, 38 insertions(+), 32 deletions(-) diff --git a/make.bat b/make.bat index 4f911c3582f..709febb0fb8 100644 --- a/make.bat +++ b/make.bat @@ -18,54 +18,34 @@ if NOT "%1" == "" ( REM Build Types if "%1" == "debug" ( - set BUILD_DIR=%BUILD_DIR%_debug set BUILD_TYPE=Debug - REM Build Configurations ) else if "%1" == "full" ( - set TARGET_SET=1 - set BUILD_DIR=%BUILD_DIR%_full + set TARGET=Full set BUILD_CMAKE_ARGS=%BUILD_CMAKE_ARGS% ^ -C"%BLENDER_DIR%\build_files\cmake\config\blender_full.cmake" ) else if "%1" == "lite" ( - set TARGET_SET=1 - set BUILD_DIR=%BUILD_DIR%_lite + set TARGET=Lite set BUILD_CMAKE_ARGS=%BUILD_CMAKE_ARGS% ^ -C"%BLENDER_DIR%\build_files\cmake\config\blender_lite.cmake" ) else if "%1" == "cycles" ( - set TARGET_SET=1 - set BUILD_DIR=%BUILD_DIR%_cycles + set TARGET=Cycles set BUILD_CMAKE_ARGS=%BUILD_CMAKE_ARGS% ^ -C"%BLENDER_DIR%\build_files\cmake\config\cycles_standalone.cmake" ) else if "%1" == "headless" ( - set TARGET_SET=1 - set BUILD_DIR=%BUILD_DIR%_headless + set TARGET=Headless set BUILD_CMAKE_ARGS=%BUILD_CMAKE_ARGS% ^ -C"%BLENDER_DIR%\build_files\cmake\config\blender_headless.cmake" ) else if "%1" == "bpy" ( - set TARGET_SET=1 - set BUILD_DIR=%BUILD_DIR%_bpy + set TARGET=Bpy set BUILD_CMAKE_ARGS=%BUILD_CMAKE_ARGS% ^ -C"%BLENDER_DIR%\build_files\cmake\config\bpy_module.cmake" ) else if "%1" == "release" ( - set TARGET_SET=1 - if "%CUDA_PATH_V7_5%"=="" ( - echo Cuda 7.5 Not found, aborting! - goto EOF - ) - if "%CUDA_PATH_V8_0%"=="" ( - echo Cuda 8.0 Not found, aborting! - goto EOF - ) - set BUILD_DIR=%BUILD_DIR%_Release - set BUILD_CMAKE_ARGS=%BUILD_CMAKE_ARGS% ^ - -C"%BLENDER_DIR%\build_files\cmake\config\blender_release.cmake" -DCUDA_NVCC_EXECUTABLE:FILEPATH=%CUDA_PATH_V7_5%/bin/nvcc.exe -DCUDA_NVCC8_EXECUTABLE:FILEPATH=%CUDA_PATH_V8_0%/bin/nvcc.exe + set TARGET=Release ) else if "%1" == "x86" ( set BUILD_ARCH=x86 - set BUILD_DIR=%BUILD_DIR%_x86 ) else if "%1" == "x64" ( set BUILD_ARCH=x64 - set BUILD_DIR=%BUILD_DIR%_x64 ) else if "%1" == "2015" ( set BUILD_VS_VER=14 set BUILD_VS_YEAR=2015 @@ -105,10 +85,13 @@ if NOT "%1" == "" ( if "%BUILD_ARCH%"=="" ( if "%PROCESSOR_ARCHITECTURE%" == "AMD64" ( set WINDOWS_ARCH= Win64 + set BUILD_ARCH=x64 ) else if "%PROCESSOR_ARCHITEW6432%" == "AMD64" ( set WINDOWS_ARCH= Win64 + set BUILD_ARCH=x64 ) else ( set WINDOWS_ARCH= + set BUILD_ARCH=x86 ) ) else if "%BUILD_ARCH%"=="x64" ( set WINDOWS_ARCH= Win64 @@ -121,7 +104,30 @@ if "%BUILD_VS_VER%"=="" ( set BUILD_VS_YEAR=2013 ) -set BUILD_DIR=%BUILD_DIR%_vc%BUILD_VS_VER% +set BUILD_DIR=%BUILD_DIR%_%TARGET%_%BUILD_ARCH%_vc%BUILD_VS_VER%_%BUILD_TYPE% + + +if "%target%"=="Release" ( + rem for vc12 check for both cuda 7.5 and 8 + if "%BUILD_VS_VER%"=="12" ( + if "%CUDA_PATH_V7_5%"=="" ( + echo Cuda 7.5 Not found, aborting! + goto EOF + ) + ) + if "%CUDA_PATH_V8_0%"=="" ( + echo Cuda 8.0 Not found, aborting! + goto EOF + ) + if "%BUILD_VS_VER%"=="12" ( + set BUILD_CMAKE_ARGS=%BUILD_CMAKE_ARGS% ^ + -C"%BLENDER_DIR%\build_files\cmake\config\blender_release.cmake" -DCUDA_NVCC_EXECUTABLE:FILEPATH=%CUDA_PATH_V7_5%/bin/nvcc.exe -DCUDA_NVCC8_EXECUTABLE:FILEPATH=%CUDA_PATH_V8_0%/bin/nvcc.exe + ) + if "%BUILD_VS_VER%"=="14" ( + set BUILD_CMAKE_ARGS=%BUILD_CMAKE_ARGS% ^ + -C"%BLENDER_DIR%\build_files\cmake\config\blender_release.cmake" -DCUDA_NVCC_EXECUTABLE:FILEPATH=%CUDA_PATH_V8_0%/bin/nvcc.exe -DCUDA_NVCC8_EXECUTABLE:FILEPATH=%CUDA_PATH_V8_0%/bin/nvcc.exe + ) +) REM Detect MSVC Installation if DEFINED VisualStudioVersion goto msvc_detect_finally @@ -156,7 +162,7 @@ if NOT EXIST %BLENDER_DIR%..\lib\nul ( echo This is needed for building, aborting! goto EOF ) -if NOT "%TARGET_SET%"=="1" ( +if "%TARGET%"=="" ( echo Error: Convenience target not set echo This is required for building, aborting! echo . @@ -224,10 +230,9 @@ goto EOF :HELP echo. echo Convenience targets - echo - release - echo - debug - echo - full - echo - lite + echo - release ^(identical to the offical blender.org builds^) + echo - full ^(same as release minus the cuda kernels^) + echo - lite echo - headless echo - cycles echo - bpy @@ -239,6 +244,7 @@ goto EOF echo - showhash ^(Show git hashes of source tree^) echo. echo Configuration options + echo - debug ^(Build an unoptimized debuggable build^) echo - packagename [newname] ^(override default cpack package name^) echo - x86 ^(override host autodetect and build 32 bit code^) echo - x64 ^(override host autodetect and build 64 bit code^) From 8deddba392a7d8e5056ac5db1c186209c8e0a8a0 Mon Sep 17 00:00:00 2001 From: Sergey Sharybin Date: Thu, 29 Sep 2016 10:05:42 +0200 Subject: [PATCH 04/25] Update source tgz builder script Was broken since splitting BKE_blender_version from BKE_blender. --- build_files/utils/build_tgz.sh | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/build_files/utils/build_tgz.sh b/build_files/utils/build_tgz.sh index 3c921081c29..865df277605 100755 --- a/build_files/utils/build_tgz.sh +++ b/build_files/utils/build_tgz.sh @@ -6,10 +6,10 @@ BASE_DIR="$PWD" blender_srcdir=$(dirname -- $0)/../.. -blender_version=$(grep "BLENDER_VERSION\s" "$blender_srcdir/source/blender/blenkernel/BKE_blender.h" | awk '{print $3}') -blender_version_char=$(grep "BLENDER_VERSION_CHAR\s" "$blender_srcdir/source/blender/blenkernel/BKE_blender.h" | awk '{print $3}') -blender_version_cycle=$(grep "BLENDER_VERSION_CYCLE\s" "$blender_srcdir/source/blender/blenkernel/BKE_blender.h" | awk '{print $3}') -blender_subversion=$(grep "BLENDER_SUBVERSION\s" "$blender_srcdir/source/blender/blenkernel/BKE_blender.h" | awk '{print $3}') +blender_version=$(grep "BLENDER_VERSION\s" "$blender_srcdir/source/blender/blenkernel/BKE_blender_version.h" | awk '{print $3}') +blender_version_char=$(grep "BLENDER_VERSION_CHAR\s" "$blender_srcdir/source/blender/blenkernel/BKE_blender_version.h" | awk '{print $3}') +blender_version_cycle=$(grep "BLENDER_VERSION_CYCLE\s" "$blender_srcdir/source/blender/blenkernel/BKE_blender_version.h" | awk '{print $3}') +blender_subversion=$(grep "BLENDER_SUBVERSION\s" "$blender_srcdir/source/blender/blenkernel/BKE_blender_version.h" | awk '{print $3}') if [ "$blender_version_cycle" = "release" ] ; then VERSION=$(expr $blender_version / 100).$(expr $blender_version % 100)$blender_version_char From 94c919349b66ef18f8cc5d3263f73222752cac93 Mon Sep 17 00:00:00 2001 From: Sergey Sharybin Date: Thu, 29 Sep 2016 10:11:40 +0200 Subject: [PATCH 05/25] Cycles: Cleanup file headers Some of the files were wrongly attributing code to some other organizations and in few places proper attribution was missing. This is mainly either a copy-paste error (when new file was created from an existing one and header wasn't updated) or due to some refactor which split non-original-BF code with purely BF code. Should solve some confusion around. --- intern/cycles/kernel/bvh/bvh.h | 3 +-- intern/cycles/kernel/bvh/bvh_types.h | 3 +-- intern/cycles/kernel/bvh/qbvh_nodes.h | 2 ++ intern/cycles/kernel/bvh/qbvh_shadow_all.h | 5 +---- intern/cycles/kernel/bvh/qbvh_subsurface.h | 5 +---- intern/cycles/kernel/bvh/qbvh_traversal.h | 5 +---- intern/cycles/kernel/bvh/qbvh_volume.h | 5 +---- intern/cycles/kernel/bvh/qbvh_volume_all.h | 5 +---- intern/cycles/kernel/geom/geom.h | 3 +-- intern/cycles/kernel/geom/geom_motion_triangle.h | 3 +-- intern/cycles/kernel/geom/geom_triangle.h | 3 +-- 11 files changed, 12 insertions(+), 30 deletions(-) diff --git a/intern/cycles/kernel/bvh/bvh.h b/intern/cycles/kernel/bvh/bvh.h index 85bfd931e6e..7cecee793c1 100644 --- a/intern/cycles/kernel/bvh/bvh.h +++ b/intern/cycles/kernel/bvh/bvh.h @@ -1,6 +1,5 @@ /* - * Adapted from code Copyright 2009-2010 NVIDIA Corporation - * Modifications Copyright 2011, Blender Foundation. + * Copyright 2011-2013 Blender Foundation * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/intern/cycles/kernel/bvh/bvh_types.h b/intern/cycles/kernel/bvh/bvh_types.h index bcba6e65fe5..27729046f8d 100644 --- a/intern/cycles/kernel/bvh/bvh_types.h +++ b/intern/cycles/kernel/bvh/bvh_types.h @@ -1,6 +1,5 @@ /* - * Adapted from code Copyright 2009-2010 NVIDIA Corporation - * Modifications Copyright 2011, Blender Foundation. + * Copyright 2011-2013 Blender Foundation * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/intern/cycles/kernel/bvh/qbvh_nodes.h b/intern/cycles/kernel/bvh/qbvh_nodes.h index 4d8695bedec..2ee2a393e80 100644 --- a/intern/cycles/kernel/bvh/qbvh_nodes.h +++ b/intern/cycles/kernel/bvh/qbvh_nodes.h @@ -12,6 +12,8 @@ * 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. + * + * Aligned nodes intersection SSE code is adopted from Embree, */ struct QBVHStackItem { diff --git a/intern/cycles/kernel/bvh/qbvh_shadow_all.h b/intern/cycles/kernel/bvh/qbvh_shadow_all.h index 3136c495b38..ae7aec2082f 100644 --- a/intern/cycles/kernel/bvh/qbvh_shadow_all.h +++ b/intern/cycles/kernel/bvh/qbvh_shadow_all.h @@ -1,8 +1,5 @@ /* - * Adapted from code Copyright 2009-2010 NVIDIA Corporation, - * and code copyright 2009-2012 Intel Corporation - * - * Modifications Copyright 2011-2014, Blender Foundation. + * Copyright 2011-2013 Blender Foundation * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/intern/cycles/kernel/bvh/qbvh_subsurface.h b/intern/cycles/kernel/bvh/qbvh_subsurface.h index 03794e3a882..24aca96a298 100644 --- a/intern/cycles/kernel/bvh/qbvh_subsurface.h +++ b/intern/cycles/kernel/bvh/qbvh_subsurface.h @@ -1,8 +1,5 @@ /* - * Adapted from code Copyright 2009-2010 NVIDIA Corporation, - * and code copyright 2009-2012 Intel Corporation - * - * Modifications Copyright 2011-2014, Blender Foundation. + * Copyright 2011-2013 Blender Foundation * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/intern/cycles/kernel/bvh/qbvh_traversal.h b/intern/cycles/kernel/bvh/qbvh_traversal.h index f82ff661495..a1e154d6dcf 100644 --- a/intern/cycles/kernel/bvh/qbvh_traversal.h +++ b/intern/cycles/kernel/bvh/qbvh_traversal.h @@ -1,8 +1,5 @@ /* - * Adapted from code Copyright 2009-2010 NVIDIA Corporation, - * and code copyright 2009-2012 Intel Corporation - * - * Modifications Copyright 2011-2014, Blender Foundation. + * Copyright 2011-2013 Blender Foundation * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/intern/cycles/kernel/bvh/qbvh_volume.h b/intern/cycles/kernel/bvh/qbvh_volume.h index aff9f559ab8..db9779351d2 100644 --- a/intern/cycles/kernel/bvh/qbvh_volume.h +++ b/intern/cycles/kernel/bvh/qbvh_volume.h @@ -1,8 +1,5 @@ /* - * Adapted from code Copyright 2009-2010 NVIDIA Corporation, - * and code copyright 2009-2012 Intel Corporation - * - * Modifications Copyright 2011-2014, Blender Foundation. + * Copyright 2011-2013 Blender Foundation * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/intern/cycles/kernel/bvh/qbvh_volume_all.h b/intern/cycles/kernel/bvh/qbvh_volume_all.h index 5d9b2edb4ba..88f1f764e4c 100644 --- a/intern/cycles/kernel/bvh/qbvh_volume_all.h +++ b/intern/cycles/kernel/bvh/qbvh_volume_all.h @@ -1,8 +1,5 @@ /* - * Adapted from code Copyright 2009-2010 NVIDIA Corporation, - * and code copyright 2009-2012 Intel Corporation - * - * Modifications Copyright 2011-2014, Blender Foundation. + * Copyright 2011-2013 Blender Foundation * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/intern/cycles/kernel/geom/geom.h b/intern/cycles/kernel/geom/geom.h index 3605394f182..24ced934c8b 100644 --- a/intern/cycles/kernel/geom/geom.h +++ b/intern/cycles/kernel/geom/geom.h @@ -1,6 +1,5 @@ /* - * Adapted from code Copyright 2009-2010 NVIDIA Corporation - * Modifications Copyright 2011, Blender Foundation. + * Copyright 2011-2013 Blender Foundation * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/intern/cycles/kernel/geom/geom_motion_triangle.h b/intern/cycles/kernel/geom/geom_motion_triangle.h index dabba3fb1f0..3cbe59aaece 100644 --- a/intern/cycles/kernel/geom/geom_motion_triangle.h +++ b/intern/cycles/kernel/geom/geom_motion_triangle.h @@ -1,6 +1,5 @@ /* - * Adapted from code Copyright 2009-2010 NVIDIA Corporation - * Modifications Copyright 2011, Blender Foundation. + * Copyright 2011-2013 Blender Foundation * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/intern/cycles/kernel/geom/geom_triangle.h b/intern/cycles/kernel/geom/geom_triangle.h index 8bd01e1008d..17538872ead 100644 --- a/intern/cycles/kernel/geom/geom_triangle.h +++ b/intern/cycles/kernel/geom/geom_triangle.h @@ -1,6 +1,5 @@ /* - * Adapted from code Copyright 2009-2010 NVIDIA Corporation - * Modifications Copyright 2011, Blender Foundation. + * Copyright 2011-2013 Blender Foundation * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. From 31ebbe40a08ac48ceb4df4f8d9008c038d9ccd94 Mon Sep 17 00:00:00 2001 From: Sergey Sharybin Date: Thu, 29 Sep 2016 10:20:24 +0200 Subject: [PATCH 06/25] Cycles: Improve OpenCL line information handling Previously it was falling back to just a path after #include statement was finished. Now we fall back to a proper current file name after dealing with the preprocessor statement. --- intern/cycles/util/util_path.cpp | 10 ++++++---- intern/cycles/util/util_path.h | 4 +++- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/intern/cycles/util/util_path.cpp b/intern/cycles/util/util_path.cpp index 9ec67cb0330..62ef8fc0b48 100644 --- a/intern/cycles/util/util_path.cpp +++ b/intern/cycles/util/util_path.cpp @@ -778,7 +778,9 @@ static string line_directive(const string& path, int line) } -string path_source_replace_includes(const string& source, const string& path) +string path_source_replace_includes(const string& source, + const string& path, + const string& source_filename) { /* Our own little c preprocessor that replaces #includes with the file * contents, to work around issue of opencl drivers not supporting @@ -807,12 +809,12 @@ string path_source_replace_includes(const string& source, const string& path) * and avoids having list of include directories.x */ text = path_source_replace_includes( - text, path_dirname(filepath)); - text = path_source_replace_includes(text, path); + text, path_dirname(filepath), filename); + text = path_source_replace_includes(text, path, filename); /* Use line directives for better error messages. */ line = line_directive(filepath, 1) + token.replace(0, n_end + 1, "\n" + text + "\n") - + line_directive(path, i); + + line_directive(path_join(path, source_filename), i); } } } diff --git a/intern/cycles/util/util_path.h b/intern/cycles/util/util_path.h index 4a89d87cbc6..70dbb5ae403 100644 --- a/intern/cycles/util/util_path.h +++ b/intern/cycles/util/util_path.h @@ -66,7 +66,9 @@ bool path_read_text(const string& path, string& text); bool path_remove(const string& path); /* source code utility */ -string path_source_replace_includes(const string& source, const string& path); +string path_source_replace_includes(const string& source, + const string& path, + const string& source_filename=""); /* cache utility */ void path_cache_clear_except(const string& name, const set& except); From 57a2015f5674ac237fd35f5ec182362e7ff6d79e Mon Sep 17 00:00:00 2001 From: Sergey Sharybin Date: Thu, 29 Sep 2016 15:00:03 +0200 Subject: [PATCH 07/25] Adopt referenced scene in the context when evaluating sequences within a Scene Strip This change makes it so that when the sequences within a Scene strip are evaluated, they use the Scene that they come from as the context as opposed the Scene that the Scene strip is in. This is necessary, for example, in the case of the MulticamSelector where it needs to reference strips in the original Scene as opposed to the Scene where the Scene strip is located. Patch by @Matt (HyperSphere), thanks! --- source/blender/blenkernel/intern/sequencer.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/source/blender/blenkernel/intern/sequencer.c b/source/blender/blenkernel/intern/sequencer.c index c240aa27343..65d751a8a72 100644 --- a/source/blender/blenkernel/intern/sequencer.c +++ b/source/blender/blenkernel/intern/sequencer.c @@ -3447,7 +3447,13 @@ static ImBuf *do_render_strip_uncached( state->scene_parents = &scene_parent; /* end check */ - ibuf = do_render_strip_seqbase(context, state, seq, nr, use_preprocess); + /* Use the Scene Seq's scene for the context when rendering the scene's sequences + * (necessary for Multicam Selector among others). + */ + SeqRenderData local_context = *context; + local_context.scene = seq->scene; + + ibuf = do_render_strip_seqbase(&local_context, state, seq, nr, use_preprocess); /* step back in the list */ state->scene_parents = state->scene_parents->next; From 333366dbcf56c30bc9dbd0e43ec57401e34cb798 Mon Sep 17 00:00:00 2001 From: Sergey Sharybin Date: Thu, 29 Sep 2016 15:48:10 +0200 Subject: [PATCH 08/25] Cycles: Fix typo in shader cancel routines --- intern/cycles/device/device_cuda.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/intern/cycles/device/device_cuda.cpp b/intern/cycles/device/device_cuda.cpp index 147e21d798a..7f8a0bf2f43 100644 --- a/intern/cycles/device/device_cuda.cpp +++ b/intern/cycles/device/device_cuda.cpp @@ -993,7 +993,7 @@ public: cuda_assert(cuCtxSynchronize()); if(task.get_cancel()) { - canceled = false; + canceled = true; break; } } From 80837d06decac612ec5dac68eca033292fcb4762 Mon Sep 17 00:00:00 2001 From: Sergey Sharybin Date: Thu, 29 Sep 2016 16:00:25 +0200 Subject: [PATCH 09/25] Cycles: Support earlier tile rendering termination on cancel It will discard the whole tile, but it's still kind of more friendly than fully locked interface (sort of) for until tile is fully sampled. Sorry if it causes PITA to merge for the opencl split work, but this issue bothering a lot when collecting benchmarks. --- intern/cycles/device/device_opencl.cpp | 42 +++++++++++++++++--------- 1 file changed, 28 insertions(+), 14 deletions(-) diff --git a/intern/cycles/device/device_opencl.cpp b/intern/cycles/device/device_opencl.cpp index c43a3878009..830e4d056b5 100644 --- a/intern/cycles/device/device_opencl.cpp +++ b/intern/cycles/device/device_opencl.cpp @@ -2346,7 +2346,9 @@ public: } } - void path_trace(SplitRenderTile& rtile, int2 max_render_feasible_tile_size) + void path_trace(DeviceTask *task, + SplitRenderTile& rtile, + int2 max_render_feasible_tile_size) { /* cast arguments to cl types */ cl_mem d_data = CL_MEM_PTR(const_mem_map["__data"]->device_pointer); @@ -2739,6 +2741,7 @@ public: /* Record number of time host intervention has been made */ unsigned int numHostIntervention = 0; unsigned int numNextPathIterTimes = PathIteration_times; + bool canceled = false; while(activeRaysAvailable) { /* Twice the global work size of other kernels for * ckPathTraceKernel_shadow_blocked_direct_lighting. */ @@ -2757,6 +2760,10 @@ public: ENQUEUE_SPLIT_KERNEL(direct_lighting, global_size, local_size); ENQUEUE_SPLIT_KERNEL(shadow_blocked, global_size_shadow_blocked, local_size); ENQUEUE_SPLIT_KERNEL(next_iteration_setup, global_size, local_size); + if(task->get_cancel()) { + canceled = true; + break; + } } /* Read ray-state into Host memory to decide if we should exit @@ -2794,22 +2801,28 @@ public: */ numNextPathIterTimes += PATH_ITER_INC_FACTOR; } + if(task->get_cancel()) { + canceled = true; + break; + } } /* Execute SumALLRadiance kernel to accumulate radiance calculated in * per_sample_output_buffers into RenderTile's output buffer. */ - size_t sum_all_radiance_local_size[2] = {16, 16}; - size_t sum_all_radiance_global_size[2]; - sum_all_radiance_global_size[0] = - (((d_w - 1) / sum_all_radiance_local_size[0]) + 1) * - sum_all_radiance_local_size[0]; - sum_all_radiance_global_size[1] = - (((d_h - 1) / sum_all_radiance_local_size[1]) + 1) * - sum_all_radiance_local_size[1]; - ENQUEUE_SPLIT_KERNEL(sum_all_radiance, - sum_all_radiance_global_size, - sum_all_radiance_local_size); + if (!canceled) { + size_t sum_all_radiance_local_size[2] = {16, 16}; + size_t sum_all_radiance_global_size[2]; + sum_all_radiance_global_size[0] = + (((d_w - 1) / sum_all_radiance_local_size[0]) + 1) * + sum_all_radiance_local_size[0]; + sum_all_radiance_global_size[1] = + (((d_h - 1) / sum_all_radiance_local_size[1]) + 1) * + sum_all_radiance_local_size[1]; + ENQUEUE_SPLIT_KERNEL(sum_all_radiance, + sum_all_radiance_global_size, + sum_all_radiance_local_size); + } #undef ENQUEUE_SPLIT_KERNEL #undef GLUE @@ -3182,7 +3195,8 @@ public: tile_iter < to_path_trace_render_tiles.size(); ++tile_iter) { - path_trace(to_path_trace_render_tiles[tile_iter], + path_trace(task, + to_path_trace_render_tiles[tile_iter], max_render_feasible_tile_size); } } @@ -3198,7 +3212,7 @@ public: /* buffer_rng_state_stride is stride itself. */ SplitRenderTile split_tile(tile); split_tile.buffer_rng_state_stride = tile.stride; - path_trace(split_tile, max_render_feasible_tile_size); + path_trace(task, split_tile, max_render_feasible_tile_size); } tile.sample = tile.start_sample + tile.num_samples; From 396a6d8a86f265c5fbb437b498b708a2f687a6f2 Mon Sep 17 00:00:00 2001 From: Ulysse Martin Date: Fri, 30 Sep 2016 07:40:17 +0200 Subject: [PATCH 10/25] UPBGE: Fix crash when calling shade_light texture when mtex has no tex. --- source/blender/gpu/intern/gpu_material.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/blender/gpu/intern/gpu_material.c b/source/blender/gpu/intern/gpu_material.c index ed9718f1a17..b857aea29ad 100644 --- a/source/blender/gpu/intern/gpu_material.c +++ b/source/blender/gpu/intern/gpu_material.c @@ -804,7 +804,7 @@ static void shade_light_textures(GPUMaterial *mat, GPULamp *lamp, GPUNodeLink ** for (int i = 0; i < MAX_MTEX; ++i) { MTex *mtex = lamp->la->mtex[i]; - if (mtex && mtex->tex->type & TEX_IMAGE && mtex->tex->ima) { + if (mtex && mtex->tex && (mtex->tex->type & TEX_IMAGE) && mtex->tex->ima) { mat->dynproperty |= DYN_LAMP_PERSMAT; float one = 1.0f; From 85d543b4acb35750ea81e12cc7c1cc5db55ce361 Mon Sep 17 00:00:00 2001 From: Bastien Montagne Date: Fri, 30 Sep 2016 10:11:29 +0200 Subject: [PATCH 11/25] Fix T49489: Pose marker in camera action + marker bound to camera -> crash. 'camera' Object pointer of TimeMarkers is a 'temp' hack since Durian project... Would need to be either made definitive now, or removed/reworked/whatever. But since we intend to use that object pointer for other needs, and current code could lead to crashing .blend files, for now let's fix that mess (was missing some bits in read code, and also totally ignored in libquery code). Should be safe for 2.78a. --- .../blender/blenkernel/intern/library_query.c | 14 ++++++++- source/blender/blenloader/intern/readfile.c | 31 ++++++++++--------- 2 files changed, 29 insertions(+), 16 deletions(-) diff --git a/source/blender/blenkernel/intern/library_query.c b/source/blender/blenkernel/intern/library_query.c index 392ac68150e..718950624e2 100644 --- a/source/blender/blenkernel/intern/library_query.c +++ b/source/blender/blenkernel/intern/library_query.c @@ -378,6 +378,10 @@ void BKE_library_foreach_ID_link(ID *id, LibraryIDLinkCallback callback, void *u CALLBACK_INVOKE(base->object, IDWALK_USER); } + for (TimeMarker *marker = scene->markers.first; marker; marker = marker->next) { + CALLBACK_INVOKE(marker->camera, IDWALK_NOP); + } + if (toolsett) { CALLBACK_INVOKE(toolsett->skgen_template, IDWALK_NOP); @@ -842,6 +846,15 @@ void BKE_library_foreach_ID_link(ID *id, LibraryIDLinkCallback callback, void *u } break; } + case ID_AC: + { + bAction *act = (bAction *) id; + + for (TimeMarker *marker = act->markers.first; marker; marker = marker->next) { + CALLBACK_INVOKE(marker->camera, IDWALK_NOP); + } + break; + } /* Nothing needed for those... */ case ID_IM: @@ -849,7 +862,6 @@ void BKE_library_foreach_ID_link(ID *id, LibraryIDLinkCallback callback, void *u case ID_TXT: case ID_SO: case ID_AR: - case ID_AC: case ID_GD: case ID_WM: case ID_PAL: diff --git a/source/blender/blenloader/intern/readfile.c b/source/blender/blenloader/intern/readfile.c index 60f276b1744..d86a89a0e48 100644 --- a/source/blender/blenloader/intern/readfile.c +++ b/source/blender/blenloader/intern/readfile.c @@ -2511,6 +2511,12 @@ static void lib_link_action(FileData *fd, Main *main) // >>> XXX deprecated - old animation system lib_link_fcurves(fd, &act->id, &act->curves); + + for (TimeMarker *marker = act->markers.first; marker; marker = marker->next) { + if (marker->camera) { + marker->camera = newlibadr(fd, act->id.lib, marker->camera); + } + } } } } @@ -5608,7 +5614,6 @@ static void lib_link_scene(FileData *fd, Main *main) Base *base, *next; Sequence *seq; SceneRenderLayer *srl; - TimeMarker *marker; FreestyleModuleConfig *fmc; FreestyleLineSet *fls; @@ -5709,15 +5714,11 @@ static void lib_link_scene(FileData *fd, Main *main) } SEQ_END -#ifdef DURIAN_CAMERA_SWITCH - for (marker = sce->markers.first; marker; marker = marker->next) { + for (TimeMarker *marker = sce->markers.first; marker; marker = marker->next) { if (marker->camera) { marker->camera = newlibadr(fd, sce->id.lib, marker->camera); } } -#else - (void)marker; -#endif BKE_sequencer_update_muting(sce->ed); BKE_sequencer_update_sound_bounds_all(sce); @@ -8860,6 +8861,12 @@ static void expand_action(FileData *fd, Main *mainvar, bAction *act) /* F-Curves in Action */ expand_fcurves(fd, mainvar, &act->curves); + + for (TimeMarker *marker = act->markers.first; marker; marker = marker->next) { + if (marker->camera) { + expand_doit(fd, mainvar, marker->camera); + } + } } static void expand_keyingsets(FileData *fd, Main *mainvar, ListBase *list) @@ -9490,17 +9497,11 @@ static void expand_scene(FileData *fd, Main *mainvar, Scene *sce) expand_doit(fd, mainvar, sce->rigidbody_world->constraints); } -#ifdef DURIAN_CAMERA_SWITCH - { - TimeMarker *marker; - - for (marker = sce->markers.first; marker; marker = marker->next) { - if (marker->camera) { - expand_doit(fd, mainvar, marker->camera); - } + for (TimeMarker *marker = sce->markers.first; marker; marker = marker->next) { + if (marker->camera) { + expand_doit(fd, mainvar, marker->camera); } } -#endif expand_doit(fd, mainvar, sce->clip); } From 5845d52bf350d5250964ad64a0ae29f758d4dfa3 Mon Sep 17 00:00:00 2001 From: Sergey Sharybin Date: Fri, 30 Sep 2016 10:36:11 +0200 Subject: [PATCH 12/25] CUEW: Use latest upstream version Fixes typo in README :) Thanks to @jesterKing! --- extern/cuew/README | 2 +- extern/cuew/README.blender | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/extern/cuew/README b/extern/cuew/README index 3c43b7278d9..2fab76015e6 100644 --- a/extern/cuew/README +++ b/extern/cuew/README @@ -4,7 +4,7 @@ for determining which CUDA functions and extensions extensions are supported on the target platform. CUDA core and extension functionality is exposed in a single header file. -GUEW has been tested on a variety of operating systems, including Windows, +CUEW has been tested on a variety of operating systems, including Windows, Linux, Mac OS X. LICENSE diff --git a/extern/cuew/README.blender b/extern/cuew/README.blender index 7e0523eda28..7b77935d750 100644 --- a/extern/cuew/README.blender +++ b/extern/cuew/README.blender @@ -1,5 +1,5 @@ Project: Cuda Wrangler URL: https://github.com/CudaWrangler/cuew License: Apache 2.0 -Upstream version: e2e0315 +Upstream version: 63d2a0f Local modifications: None From eb9521ae0469156d4f48f5defbb05046416b2af4 Mon Sep 17 00:00:00 2001 From: Sergey Sharybin Date: Fri, 30 Sep 2016 11:05:01 +0200 Subject: [PATCH 13/25] Depsgraph: Report proper error when modifier fails to create relation link --- .../depsgraph/intern/builder/deg_builder_relations.h | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/source/blender/depsgraph/intern/builder/deg_builder_relations.h b/source/blender/depsgraph/intern/builder/deg_builder_relations.h index 46e65d464a4..5240aa24b54 100644 --- a/source/blender/depsgraph/intern/builder/deg_builder_relations.h +++ b/source/blender/depsgraph/intern/builder/deg_builder_relations.h @@ -370,10 +370,12 @@ void DepsgraphRelationBuilder::add_node_handle_relation( } else { if (!op_from) { - /* XXX TODO handle as error or report if needed */ + fprintf(stderr, "add_node_handle_relation(%d, %s) - Could not find op_from (%s)\n", + type, description, key_from.identifier().c_str()); } if (!op_to) { - /* XXX TODO handle as error or report if needed */ + fprintf(stderr, "add_node_handle_relation(%d, %s) - Could not find op_to (%s)\n", + type, description, key_from.identifier().c_str()); } } } From 6a4ca1e5c0a08806a4b5bbe4a68dfafff0104ae7 Mon Sep 17 00:00:00 2001 From: Sergey Sharybin Date: Fri, 30 Sep 2016 11:13:28 +0200 Subject: [PATCH 14/25] Normal edit modifier: Fix relation builder for the new dependency graph --- source/blender/modifiers/intern/MOD_normal_edit.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/blender/modifiers/intern/MOD_normal_edit.c b/source/blender/modifiers/intern/MOD_normal_edit.c index ceb7dc02699..ffe5e6aa7c7 100644 --- a/source/blender/modifiers/intern/MOD_normal_edit.c +++ b/source/blender/modifiers/intern/MOD_normal_edit.c @@ -533,7 +533,7 @@ static void updateDepsgraph(ModifierData *md, { NormalEditModifierData *smd = (NormalEditModifierData *) md; if (smd->target) { - DEG_add_object_relation(node, smd->target, DEG_OB_COMP_GEOMETRY, "NormalEdit Modifier"); + DEG_add_object_relation(node, smd->target, DEG_OB_COMP_TRANSFORM, "NormalEdit Modifier"); } } From 70a40ff65a6dd017b609f57bdc5e0e8022964e77 Mon Sep 17 00:00:00 2001 From: Sergey Sharybin Date: Fri, 30 Sep 2016 12:15:18 +0200 Subject: [PATCH 15/25] Cleanup: Naming in EditNormals modifier --- .../modifiers/intern/MOD_normal_edit.c | 84 +++++++++---------- 1 file changed, 42 insertions(+), 42 deletions(-) diff --git a/source/blender/modifiers/intern/MOD_normal_edit.c b/source/blender/modifiers/intern/MOD_normal_edit.c index ffe5e6aa7c7..454c97451a8 100644 --- a/source/blender/modifiers/intern/MOD_normal_edit.c +++ b/source/blender/modifiers/intern/MOD_normal_edit.c @@ -188,7 +188,7 @@ static bool polygons_check_flip( } static void normalEditModifier_do_radial( - NormalEditModifierData *smd, Object *ob, DerivedMesh *dm, + NormalEditModifierData *enmd, Object *ob, DerivedMesh *dm, short (*clnors)[2], float (*loopnors)[3], float (*polynors)[3], const short mix_mode, const float mix_factor, const float mix_limit, MDeformVert *dvert, const int defgrp_index, const bool use_invert_vgroup, @@ -203,7 +203,7 @@ static void normalEditModifier_do_radial( BLI_bitmap *done_verts = BLI_BITMAP_NEW((size_t)num_verts, __func__); - generate_vert_coordinates(dm, ob, smd->target, smd->offset, num_verts, cos, size); + generate_vert_coordinates(dm, ob, enmd->target, enmd->offset, num_verts, cos, size); /** * size gives us our spheroid coefficients ``(A, B, C)``. @@ -287,14 +287,14 @@ static void normalEditModifier_do_radial( } static void normalEditModifier_do_directional( - NormalEditModifierData *smd, Object *ob, DerivedMesh *dm, + NormalEditModifierData *enmd, Object *ob, DerivedMesh *dm, short (*clnors)[2], float (*loopnors)[3], float (*polynors)[3], const short mix_mode, const float mix_factor, const float mix_limit, MDeformVert *dvert, const int defgrp_index, const bool use_invert_vgroup, MVert *mvert, const int num_verts, MEdge *medge, const int num_edges, MLoop *mloop, const int num_loops, MPoly *mpoly, const int num_polys) { - const bool use_parallel_normals = (smd->flag & MOD_NORMALEDIT_USE_DIRECTION_PARALLEL) != 0; + const bool use_parallel_normals = (enmd->flag & MOD_NORMALEDIT_USE_DIRECTION_PARALLEL) != 0; float (*cos)[3] = MEM_mallocN(sizeof(*cos) * num_verts, __func__); float (*nos)[3] = MEM_mallocN(sizeof(*nos) * num_loops, __func__); @@ -309,14 +309,14 @@ static void normalEditModifier_do_directional( float mat[4][4]; invert_m4_m4(mat, ob->obmat); - mul_m4_m4m4(mat, mat, smd->target->obmat); + mul_m4_m4m4(mat, mat, enmd->target->obmat); copy_v3_v3(target_co, mat[3]); } if (use_parallel_normals) { float no[3]; - sub_v3_v3v3(no, target_co, smd->offset); + sub_v3_v3v3(no, target_co, enmd->offset); normalize_v3(no); for (i = num_loops; i--; ) { @@ -362,19 +362,19 @@ static void normalEditModifier_do_directional( MEM_freeN(nos); } -static bool is_valid_target(NormalEditModifierData *smd) +static bool is_valid_target(NormalEditModifierData *enmd) { - if (smd->mode == MOD_NORMALEDIT_MODE_RADIAL) { + if (enmd->mode == MOD_NORMALEDIT_MODE_RADIAL) { return true; } - else if ((smd->mode == MOD_NORMALEDIT_MODE_DIRECTIONAL) && smd->target) { + else if ((enmd->mode == MOD_NORMALEDIT_MODE_DIRECTIONAL) && enmd->target) { return true; } - modifier_setError((ModifierData *)smd, "Invalid target settings"); + modifier_setError((ModifierData *)enmd, "Invalid target settings"); return false; } -static DerivedMesh *normalEditModifier_do(NormalEditModifierData *smd, Object *ob, DerivedMesh *dm) +static DerivedMesh *normalEditModifier_do(NormalEditModifierData *enmd, Object *ob, DerivedMesh *dm) { Mesh *me = ob->data; @@ -387,11 +387,11 @@ static DerivedMesh *normalEditModifier_do(NormalEditModifierData *smd, Object *o MLoop *mloop; MPoly *mpoly; - const bool use_invert_vgroup = ((smd->flag & MOD_NORMALEDIT_INVERT_VGROUP) != 0); - const bool use_current_clnors = !((smd->mix_mode == MOD_NORMALEDIT_MIX_COPY) && - (smd->mix_factor == 1.0f) && - (smd->defgrp_name[0] == '\0') && - (smd->mix_limit == (float)M_PI)); + const bool use_invert_vgroup = ((enmd->flag & MOD_NORMALEDIT_INVERT_VGROUP) != 0); + const bool use_current_clnors = !((enmd->mix_mode == MOD_NORMALEDIT_MIX_COPY) && + (enmd->mix_factor == 1.0f) && + (enmd->defgrp_name[0] == '\0') && + (enmd->mix_limit == (float)M_PI)); int defgrp_index; MDeformVert *dvert; @@ -403,12 +403,12 @@ static DerivedMesh *normalEditModifier_do(NormalEditModifierData *smd, Object *o bool free_polynors = false; /* Do not run that modifier at all if autosmooth is disabled! */ - if (!is_valid_target(smd) || !num_loops) { + if (!is_valid_target(enmd) || !num_loops) { return dm; } if (!(me->flag & ME_AUTOSMOOTH)) { - modifier_setError((ModifierData *)smd, "Enable 'Auto Smooth' option in mesh settings"); + modifier_setError((ModifierData *)enmd, "Enable 'Auto Smooth' option in mesh settings"); return dm; } @@ -441,18 +441,18 @@ static DerivedMesh *normalEditModifier_do(NormalEditModifierData *smd, Object *o free_polynors = true; } - modifier_get_vgroup(ob, dm, smd->defgrp_name, &dvert, &defgrp_index); + modifier_get_vgroup(ob, dm, enmd->defgrp_name, &dvert, &defgrp_index); - if (smd->mode == MOD_NORMALEDIT_MODE_RADIAL) { + if (enmd->mode == MOD_NORMALEDIT_MODE_RADIAL) { normalEditModifier_do_radial( - smd, ob, dm, clnors, loopnors, polynors, - smd->mix_mode, smd->mix_factor, smd->mix_limit, dvert, defgrp_index, use_invert_vgroup, + enmd, ob, dm, clnors, loopnors, polynors, + enmd->mix_mode, enmd->mix_factor, enmd->mix_limit, dvert, defgrp_index, use_invert_vgroup, mvert, num_verts, medge, num_edges, mloop, num_loops, mpoly, num_polys); } - else if (smd->mode == MOD_NORMALEDIT_MODE_DIRECTIONAL) { + else if (enmd->mode == MOD_NORMALEDIT_MODE_DIRECTIONAL) { normalEditModifier_do_directional( - smd, ob, dm, clnors, loopnors, polynors, - smd->mix_mode, smd->mix_factor, smd->mix_limit, dvert, defgrp_index, use_invert_vgroup, + enmd, ob, dm, clnors, loopnors, polynors, + enmd->mix_mode, enmd->mix_factor, enmd->mix_limit, dvert, defgrp_index, use_invert_vgroup, mvert, num_verts, medge, num_edges, mloop, num_loops, mpoly, num_polys); } @@ -465,13 +465,13 @@ static DerivedMesh *normalEditModifier_do(NormalEditModifierData *smd, Object *o static void initData(ModifierData *md) { - NormalEditModifierData *smd = (NormalEditModifierData *)md; + NormalEditModifierData *enmd = (NormalEditModifierData *)md; - smd->mode = MOD_NORMALEDIT_MODE_RADIAL; + enmd->mode = MOD_NORMALEDIT_MODE_RADIAL; - smd->mix_mode = MOD_NORMALEDIT_MIX_COPY; - smd->mix_factor = 1.0f; - smd->mix_limit = M_PI; + enmd->mix_mode = MOD_NORMALEDIT_MIX_COPY; + enmd->mix_factor = 1.0f; + enmd->mix_limit = M_PI; } static void copyData(ModifierData *md, ModifierData *target) @@ -481,11 +481,11 @@ static void copyData(ModifierData *md, ModifierData *target) static CustomDataMask requiredDataMask(Object *UNUSED(ob), ModifierData *md) { - NormalEditModifierData *smd = (NormalEditModifierData *)md; + NormalEditModifierData *enmd = (NormalEditModifierData *)md; CustomDataMask dataMask = CD_CUSTOMLOOPNORMAL; /* Ask for vertexgroups if we need them. */ - if (smd->defgrp_name[0]) { + if (enmd->defgrp_name[0]) { dataMask |= (CD_MASK_MDEFORMVERT); } @@ -499,16 +499,16 @@ static bool dependsOnNormals(ModifierData *UNUSED(md)) static void foreachObjectLink(ModifierData *md, Object *ob, ObjectWalkFunc walk, void *userData) { - NormalEditModifierData *smd = (NormalEditModifierData *) md; + NormalEditModifierData *enmd = (NormalEditModifierData *) md; - walk(userData, ob, &smd->target, IDWALK_NOP); + walk(userData, ob, &enmd->target, IDWALK_NOP); } static bool isDisabled(ModifierData *md, int UNUSED(useRenderParams)) { - NormalEditModifierData *smd = (NormalEditModifierData *)md; + NormalEditModifierData *enmd = (NormalEditModifierData *)md; - return !is_valid_target(smd); + return !is_valid_target(enmd); } static void updateDepgraph(ModifierData *md, DagForest *forest, @@ -516,10 +516,10 @@ static void updateDepgraph(ModifierData *md, DagForest *forest, struct Scene *UNUSED(scene), Object *UNUSED(ob), DagNode *obNode) { - NormalEditModifierData *smd = (NormalEditModifierData *) md; + NormalEditModifierData *enmd = (NormalEditModifierData *) md; - if (smd->target) { - DagNode *Node = dag_get_node(forest, smd->target); + if (enmd->target) { + DagNode *Node = dag_get_node(forest, enmd->target); dag_add_relation(forest, Node, obNode, DAG_RL_OB_DATA, "NormalEdit Modifier"); } @@ -531,9 +531,9 @@ static void updateDepsgraph(ModifierData *md, Object *UNUSED(ob), struct DepsNodeHandle *node) { - NormalEditModifierData *smd = (NormalEditModifierData *) md; - if (smd->target) { - DEG_add_object_relation(node, smd->target, DEG_OB_COMP_TRANSFORM, "NormalEdit Modifier"); + NormalEditModifierData *enmd = (NormalEditModifierData *) md; + if (enmd->target) { + DEG_add_object_relation(node, enmd->target, DEG_OB_COMP_TRANSFORM, "NormalEdit Modifier"); } } From 20c6d5e3cb71acb9e783ddcbce89a42914db9ec6 Mon Sep 17 00:00:00 2001 From: Brecht Van Lommel Date: Mon, 26 Sep 2016 03:42:09 +0200 Subject: [PATCH 16/25] Fix MSVC compiler warning due to using */* to start comment. --- intern/cycles/render/mesh_subdivision.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/intern/cycles/render/mesh_subdivision.cpp b/intern/cycles/render/mesh_subdivision.cpp index 0ae5ff742c2..813b23ed91e 100644 --- a/intern/cycles/render/mesh_subdivision.cpp +++ b/intern/cycles/render/mesh_subdivision.cpp @@ -109,7 +109,7 @@ namespace Far { template<> void TopologyRefinerFactory::reportInvalidTopology(TopologyError /*err_code*/, - char const */*msg*/, ccl::Mesh const& /*mesh*/) + char const * /*msg*/, ccl::Mesh const& /*mesh*/) { } } /* namespace Far */ From 95fa303efd0b6e2963af423e601bb2869ac82520 Mon Sep 17 00:00:00 2001 From: Sebastian Witt <> Date: Sat, 1 Oct 2016 01:54:44 +0200 Subject: [PATCH 17/25] Add default UV coordinates for torus primitive. Fixes T47489. Reviewed By: brecht --- .../startup/bl_operators/add_mesh_torus.py | 40 +++++++++++++++++++ 1 file changed, 40 insertions(+) diff --git a/release/scripts/startup/bl_operators/add_mesh_torus.py b/release/scripts/startup/bl_operators/add_mesh_torus.py index 82014c87be9..303a8b01192 100644 --- a/release/scripts/startup/bl_operators/add_mesh_torus.py +++ b/release/scripts/startup/bl_operators/add_mesh_torus.py @@ -23,6 +23,7 @@ from bpy.types import Operator from bpy.props import ( FloatProperty, IntProperty, + BoolProperty, ) from bpy.app.translations import pgettext_data as data_ @@ -81,6 +82,33 @@ def add_torus(major_rad, minor_rad, major_seg, minor_seg): return verts, faces +def add_uvs(mesh, minor_seg, major_seg): + mesh.uv_textures.new() + uv_layer = mesh.uv_layers.active + u_step = 1.0/major_seg + v_step = 1.0/minor_seg + vertex_index = 0 + + u = 0.5 + for major_index in range(major_seg): + v = 0.5 + for minor_index in range(minor_seg): + loops = mesh.polygons[vertex_index].loop_indices + if minor_index == minor_seg-1 and major_index == 0: + uv_layer.data[loops[1]].uv = (u, v) + uv_layer.data[loops[2]].uv = (u + u_step, v) + uv_layer.data[loops[0]].uv = (u, v + v_step) + uv_layer.data[loops[3]].uv = (u + u_step, v + v_step) + else: + uv_layer.data[loops[0]].uv = (u, v) + uv_layer.data[loops[1]].uv = (u + u_step, v) + uv_layer.data[loops[3]].uv = (u, v + v_step) + uv_layer.data[loops[2]].uv = (u + u_step, v + v_step) + v = (v + v_step) % 1.0 + vertex_index += 1 + u = (u + u_step) % 1.0 + + class AddTorus(Operator, object_utils.AddObjectHelper): """Add a torus mesh""" bl_idname = "mesh.primitive_torus_add" @@ -145,10 +173,18 @@ class AddTorus(Operator, object_utils.AddObjectHelper): subtype='DISTANCE', unit='LENGTH', ) + generate_uvs = BoolProperty( + name="Generate UVs", + description="Generate a default UV map", + default=False, + ) def draw(self, context): layout = self.layout + col = layout.column(align=True) + col.prop(self, 'generate_uvs') + col.separator() col.prop(self, 'view_align') col = layout.column(align=True) @@ -217,6 +253,10 @@ class AddTorus(Operator, object_utils.AddObjectHelper): mesh.polygons.foreach_set("loop_start", range(0, nbr_loops, 4)) mesh.polygons.foreach_set("loop_total", (4,) * nbr_polys) mesh.loops.foreach_set("vertex_index", faces) + + if self.generate_uvs: + add_uvs(mesh, self.minor_segments, self.major_segments) + mesh.update() object_utils.object_data_add(context, mesh, operator=self) From 40eedd5df9083ce54c38c6307946488a1fa8aae0 Mon Sep 17 00:00:00 2001 From: Alexander Gavrilov Date: Thu, 29 Sep 2016 00:35:53 +0300 Subject: [PATCH 18/25] Cycles: implement partial constant folding for exponentiation. This is also an important mathematical operation that can be folded if it is known that one argument is a certain constant. For colors the operation is provided as a Gamma node. The SVM Gamma node needs a small fix to make it follow the 0 ^ 0 == 1 rule, same as the Power node, or the Gamma node itself in OSL mode. Reviewers: #cycles Differential Revision: https://developer.blender.org/D2263 --- intern/cycles/kernel/svm/svm_math_util.h | 3 + intern/cycles/render/constant_fold.cpp | 22 ++++ intern/cycles/render/constant_fold.h | 1 + intern/cycles/render/nodes.cpp | 13 +++ .../test/render_graph_finalize_test.cpp | 100 ++++++++++++++++++ 5 files changed, 139 insertions(+) diff --git a/intern/cycles/kernel/svm/svm_math_util.h b/intern/cycles/kernel/svm/svm_math_util.h index 6d13a0d8e02..01547b60014 100644 --- a/intern/cycles/kernel/svm/svm_math_util.h +++ b/intern/cycles/kernel/svm/svm_math_util.h @@ -164,6 +164,9 @@ ccl_device float3 svm_math_blackbody_color(float t) { ccl_device_inline float3 svm_math_gamma_color(float3 color, float gamma) { + if(gamma == 0.0f) + return make_float3(1.0f, 1.0f, 1.0f); + if(color.x > 0.0f) color.x = powf(color.x, gamma); if(color.y > 0.0f) diff --git a/intern/cycles/render/constant_fold.cpp b/intern/cycles/render/constant_fold.cpp index 200a4c497cd..b7f25663bc3 100644 --- a/intern/cycles/render/constant_fold.cpp +++ b/intern/cycles/render/constant_fold.cpp @@ -89,6 +89,19 @@ void ConstantFolder::make_zero() const } } +void ConstantFolder::make_one() const +{ + if(output->type() == SocketType::FLOAT) { + make_constant(1.0f); + } + else if(SocketType::is_float3(output->type())) { + make_constant(make_float3(1.0f, 1.0f, 1.0f)); + } + else { + assert(0); + } +} + void ConstantFolder::bypass(ShaderOutput *new_output) const { assert(new_output); @@ -321,6 +334,15 @@ void ConstantFolder::fold_math(NodeMath type, bool clamp) const make_zero(); } break; + case NODE_MATH_POWER: + /* 1 ^ X == X ^ 0 == 1 */ + if(is_one(value1_in) || is_zero(value2_in)) { + make_one(); + } + /* X ^ 1 == X */ + else if(is_one(value2_in)) { + try_bypass_or_make_constant(value1_in, clamp); + } default: break; } diff --git a/intern/cycles/render/constant_fold.h b/intern/cycles/render/constant_fold.h index 2b31c2a5887..7962698319f 100644 --- a/intern/cycles/render/constant_fold.h +++ b/intern/cycles/render/constant_fold.h @@ -43,6 +43,7 @@ public: void make_constant_clamp(float value, bool clamp) const; void make_constant_clamp(float3 value, bool clamp) const; void make_zero() const; + void make_one() const; /* Bypass node, relinking to another output socket. */ void bypass(ShaderOutput *output) const; diff --git a/intern/cycles/render/nodes.cpp b/intern/cycles/render/nodes.cpp index df43863ea7a..7ea52b28b9c 100644 --- a/intern/cycles/render/nodes.cpp +++ b/intern/cycles/render/nodes.cpp @@ -3896,6 +3896,19 @@ void GammaNode::constant_fold(const ConstantFolder& folder) if(folder.all_inputs_constant()) { folder.make_constant(svm_math_gamma_color(color, gamma)); } + else { + ShaderInput *color_in = input("Color"); + ShaderInput *gamma_in = input("Gamma"); + + /* 1 ^ X == X ^ 0 == 1 */ + if(folder.is_one(color_in) || folder.is_zero(gamma_in)) { + folder.make_one(); + } + /* X ^ 1 == X */ + else if(folder.is_one(gamma_in)) { + folder.try_bypass_or_make_constant(color_in, false); + } + } } void GammaNode::compile(SVMCompiler& compiler) diff --git a/intern/cycles/test/render_graph_finalize_test.cpp b/intern/cycles/test/render_graph_finalize_test.cpp index 60e41be16aa..6f1c0b88b51 100644 --- a/intern/cycles/test/render_graph_finalize_test.cpp +++ b/intern/cycles/test/render_graph_finalize_test.cpp @@ -930,6 +930,72 @@ TEST(render_graph, constant_fold_gamma) graph.finalize(&scene); } +/* + * Tests: Gamma with one constant 0 input. + */ +TEST(render_graph, constant_fold_gamma_part_0) +{ + DEFINE_COMMON_VARIABLES(builder, log); + + EXPECT_ANY_MESSAGE(log); + INVALID_INFO_MESSAGE(log, "Folding Gamma_Cx::"); + CORRECT_INFO_MESSAGE(log, "Folding Gamma_xC::Color to constant (1, 1, 1)."); + + builder + .add_attribute("Attribute") + /* constant on the left */ + .add_node(ShaderNodeBuilder("Gamma_Cx") + .set("Color", make_float3(0.0f, 0.0f, 0.0f))) + .add_connection("Attribute::Fac", "Gamma_Cx::Gamma") + /* constant on the right */ + .add_node(ShaderNodeBuilder("Gamma_xC") + .set("Gamma", 0.0f)) + .add_connection("Attribute::Color", "Gamma_xC::Color") + /* output sum */ + .add_node(ShaderNodeBuilder("Out") + .set(&MixNode::type, NODE_MIX_ADD) + .set(&MixNode::use_clamp, true) + .set("Fac", 1.0f)) + .add_connection("Gamma_Cx::Color", "Out::Color1") + .add_connection("Gamma_xC::Color", "Out::Color2") + .output_color("Out::Color"); + + graph.finalize(&scene); +} + +/* + * Tests: Gamma with one constant 1 input. + */ +TEST(render_graph, constant_fold_gamma_part_1) +{ + DEFINE_COMMON_VARIABLES(builder, log); + + EXPECT_ANY_MESSAGE(log); + CORRECT_INFO_MESSAGE(log, "Folding Gamma_Cx::Color to constant (1, 1, 1)."); + CORRECT_INFO_MESSAGE(log, "Folding Gamma_xC::Color to socket Attribute::Color."); + + builder + .add_attribute("Attribute") + /* constant on the left */ + .add_node(ShaderNodeBuilder("Gamma_Cx") + .set("Color", make_float3(1.0f, 1.0f, 1.0f))) + .add_connection("Attribute::Fac", "Gamma_Cx::Gamma") + /* constant on the right */ + .add_node(ShaderNodeBuilder("Gamma_xC") + .set("Gamma", 1.0f)) + .add_connection("Attribute::Color", "Gamma_xC::Color") + /* output sum */ + .add_node(ShaderNodeBuilder("Out") + .set(&MixNode::type, NODE_MIX_ADD) + .set(&MixNode::use_clamp, true) + .set("Fac", 1.0f)) + .add_connection("Gamma_Cx::Color", "Out::Color1") + .add_connection("Gamma_xC::Color", "Out::Color2") + .output_color("Out::Color"); + + graph.finalize(&scene); +} + /* * Tests: BrightnessContrast with all constant inputs. */ @@ -1142,6 +1208,40 @@ TEST(render_graph, constant_fold_part_math_div_0) graph.finalize(&scene); } +/* + * Tests: partial folding for Math Power with known 0. + */ +TEST(render_graph, constant_fold_part_math_pow_0) +{ + DEFINE_COMMON_VARIABLES(builder, log); + + EXPECT_ANY_MESSAGE(log); + /* X ^ 0 == 1 */ + INVALID_INFO_MESSAGE(log, "Folding Math_Cx::"); + CORRECT_INFO_MESSAGE(log, "Folding Math_xC::Value to constant (1)."); + INVALID_INFO_MESSAGE(log, "Folding Out::"); + + build_math_partial_test_graph(builder, NODE_MATH_POWER, 0.0f); + graph.finalize(&scene); +} + +/* + * Tests: partial folding for Math Power with known 1. + */ +TEST(render_graph, constant_fold_part_math_pow_1) +{ + DEFINE_COMMON_VARIABLES(builder, log); + + EXPECT_ANY_MESSAGE(log); + /* 1 ^ X == 1; X ^ 1 == X */ + CORRECT_INFO_MESSAGE(log, "Folding Math_Cx::Value to constant (1)"); + CORRECT_INFO_MESSAGE(log, "Folding Math_xC::Value to socket Attribute::Fac."); + INVALID_INFO_MESSAGE(log, "Folding Out::"); + + build_math_partial_test_graph(builder, NODE_MATH_POWER, 1.0f); + graph.finalize(&scene); +} + /* * Tests: Vector Math with all constant inputs. */ From 15e756c5841db71d1b0c308f0b9c12e468f137bd Mon Sep 17 00:00:00 2001 From: Brecht Van Lommel Date: Sat, 1 Oct 2016 14:44:11 +0200 Subject: [PATCH 19/25] Fix wrong Cycles GLSL pointiness, still not supported but should be neutral 0.5. --- source/blender/gpu/shaders/gpu_shader_material.glsl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/blender/gpu/shaders/gpu_shader_material.glsl b/source/blender/gpu/shaders/gpu_shader_material.glsl index 119bfb61fec..67da8201f66 100644 --- a/source/blender/gpu/shaders/gpu_shader_material.glsl +++ b/source/blender/gpu/shaders/gpu_shader_material.glsl @@ -2705,7 +2705,7 @@ void node_geometry( parametric = vec3(0.0); backfacing = (gl_FrontFacing) ? 0.0 : 1.0; - pointiness = 0.0; + pointiness = 0.5; } void node_tex_coord( From 4a423862e9fe405f31168f9a1355d6727e7ad923 Mon Sep 17 00:00:00 2001 From: lazydodo Date: Sat, 1 Oct 2016 10:22:28 -0600 Subject: [PATCH 20/25] [MSVC] Make.bat updates. - Explicitly specify the platform for msbuild, to facilitate builds with just the Visual C++ Build Tools installed. - When vs2013 is not found, try looking for 2015 as a fallback - Clear up any batch variables that might have been set from previous runs --- make.bat | 39 ++++++++++++++++++++++++++++++++------- 1 file changed, 32 insertions(+), 7 deletions(-) diff --git a/make.bat b/make.bat index 709febb0fb8..fb3b4b859db 100644 --- a/make.bat +++ b/make.bat @@ -6,7 +6,17 @@ setlocal ENABLEEXTENSIONS set BLENDER_DIR=%~dp0 set BUILD_DIR=%BLENDER_DIR%..\build_windows set BUILD_TYPE=Release +rem reset all variables so they do not get accidentally get carried over from previous builds set BUILD_CMAKE_ARGS= +set BUILD_ARCH= +set BUILD_VS_VER= +set BUILD_VS_YEAR= +set KEY_NAME= +set MSBUILD_PLATFORM= +set MUST_CLEAN= +set NOBUILD= +set TARGET= +set WINDOWS_ARCH= :argv_loop if NOT "%1" == "" ( @@ -95,8 +105,10 @@ if "%BUILD_ARCH%"=="" ( ) ) else if "%BUILD_ARCH%"=="x64" ( set WINDOWS_ARCH= Win64 + set MSBUILD_PLATFORM=x64 ) else if "%BUILD_ARCH%"=="x86" ( set WINDOWS_ARCH= + set MSBUILD_PLATFORM=win32 ) if "%BUILD_VS_VER%"=="" ( @@ -129,6 +141,7 @@ if "%target%"=="Release" ( ) ) +:DetectMSVC REM Detect MSVC Installation if DEFINED VisualStudioVersion goto msvc_detect_finally set VALUE_NAME=ProductDir @@ -146,10 +159,18 @@ if DEFINED MSVC_VC_DIR call "%MSVC_VC_DIR%\vcvarsall.bat" REM Sanity Checks where /Q msbuild if %ERRORLEVEL% NEQ 0 ( - echo Error: "MSBuild" command not in the PATH. - echo You must have MSVC installed and run this from the "Developer Command Prompt" - echo ^(available from Visual Studio's Start menu entry^), aborting! - goto EOF + if "%BUILD_VS_VER%"=="12" ( + rem vs12 not found, try vs14 + echo Visual Studio 2012 not found, trying Visual Studio 2015. + set BUILD_VS_VER=14 + set BUILD_VS_YEAR=2015 + goto DetectMSVC + ) else ( + echo Error: "MSBuild" command not in the PATH. + echo You must have MSVC installed and run this from the "Developer Command Prompt" + echo ^(available from Visual Studio's Start menu entry^), aborting! + goto EOF + ) ) where /Q cmake if %ERRORLEVEL% NEQ 0 ( @@ -179,7 +200,9 @@ if "%MUST_CLEAN%"=="1" ( %BUILD_DIR%\Blender.sln ^ /target:clean ^ /property:Configuration=%BUILD_TYPE% ^ - /verbosity:minimal + /verbosity:minimal ^ + /p:platform=%MSBUILD_PLATFORM% + if %ERRORLEVEL% NEQ 0 ( echo Cleaned "%BUILD_DIR%" ) @@ -208,7 +231,8 @@ msbuild ^ /target:build ^ /property:Configuration=%BUILD_TYPE% ^ /maxcpucount ^ - /verbosity:minimal + /verbosity:minimal ^ + /p:platform=%MSBUILD_PLATFORM% if %ERRORLEVEL% NEQ 0 ( echo "Build Failed" @@ -218,7 +242,8 @@ if %ERRORLEVEL% NEQ 0 ( msbuild ^ %BUILD_DIR%\INSTALL.vcxproj ^ /property:Configuration=%BUILD_TYPE% ^ - /verbosity:minimal + /verbosity:minimal ^ + /p:platform=%MSBUILD_PLATFORM% echo. echo At any point you can optionally modify your build configuration by editing: From ad23ee761bb729f013ffc1f5e32f032bded9dcd6 Mon Sep 17 00:00:00 2001 From: Brecht Van Lommel Date: Sat, 1 Oct 2016 19:14:38 +0200 Subject: [PATCH 21/25] Fix T49502: file browser on OS X not highlighting system folders and bookmarks. --- source/blender/editors/space_file/fsmenu.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/source/blender/editors/space_file/fsmenu.c b/source/blender/editors/space_file/fsmenu.c index e71c05d19c5..72034b4f828 100644 --- a/source/blender/editors/space_file/fsmenu.c +++ b/source/blender/editors/space_file/fsmenu.c @@ -559,6 +559,9 @@ void fsmenu_read_system(struct FSMenu *fsmenu, int read_bookmarks) if (pathString == NULL || !CFStringGetCString(pathString, line, sizeof(line), kCFStringEncodingUTF8)) continue; + /* Add end slash for consistency with other platforms */ + BLI_add_slash(line); + /* Exclude "all my files" as it makes no sense in blender fileselector */ /* Exclude "airdrop" if wlan not active as it would show "" ) */ if (!strstr(line, "myDocuments.cannedSearch") && (*line != '\0')) { From 11e93c5f2bd58db3079cf62654eae47fd2546721 Mon Sep 17 00:00:00 2001 From: lazydodo Date: Sat, 1 Oct 2016 11:21:42 -0600 Subject: [PATCH 22/25] [msvc] make.bat - Fix:msbuild platform wasn't set when the architecture was auto detected. --- make.bat | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/make.bat b/make.bat index fb3b4b859db..022075805e4 100644 --- a/make.bat +++ b/make.bat @@ -105,10 +105,8 @@ if "%BUILD_ARCH%"=="" ( ) ) else if "%BUILD_ARCH%"=="x64" ( set WINDOWS_ARCH= Win64 - set MSBUILD_PLATFORM=x64 ) else if "%BUILD_ARCH%"=="x86" ( set WINDOWS_ARCH= - set MSBUILD_PLATFORM=win32 ) if "%BUILD_VS_VER%"=="" ( @@ -116,6 +114,13 @@ if "%BUILD_VS_VER%"=="" ( set BUILD_VS_YEAR=2013 ) +if "%BUILD_ARCH%"=="x64" ( + set MSBUILD_PLATFORM=x64 + ) else if "%BUILD_ARCH%"=="x86" ( + set MSBUILD_PLATFORM=win32 +) + + set BUILD_DIR=%BUILD_DIR%_%TARGET%_%BUILD_ARCH%_vc%BUILD_VS_VER%_%BUILD_TYPE% From fd2bffd22e9e1eba456fe16df98c8ed7f3b3eaf3 Mon Sep 17 00:00:00 2001 From: Germano Cavalcante Date: Sat, 1 Oct 2016 16:50:34 -0300 Subject: [PATCH 23/25] [Fix unreported bug] Snap align with normal was not working in derivade mesh The `use_snapp_align_rotation` option was using only the first vertex --- source/blender/editors/transform/transform_snap_object.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/source/blender/editors/transform/transform_snap_object.c b/source/blender/editors/transform/transform_snap_object.c index 1d4872cca7a..02900d7022c 100644 --- a/source/blender/editors/transform/transform_snap_object.c +++ b/source/blender/editors/transform/transform_snap_object.c @@ -294,7 +294,7 @@ static void copy_vert_no(const BVHTreeFromMeshType *meshdata, const int index, f case SNAP_MESH: { BVHTreeFromMesh *data = meshdata->userdata; - const MVert *vert = data->vert; + const MVert *vert = data->vert + index; normal_short_to_float_v3(r_no, vert->no); break; } @@ -1302,6 +1302,7 @@ static bool snapDerivedMesh( } } } + /* SCE_SNAP_MODE_VERTEX or SCE_SNAP_MODE_EDGE */ else { const ARegion *ar = sctx->v3d_data.ar; From 641e586b15ad4eb8f35e5b591bfc807b58ebcd80 Mon Sep 17 00:00:00 2001 From: Brecht Van Lommel Date: Sat, 1 Oct 2016 22:40:35 +0200 Subject: [PATCH 24/25] Fix T49520: broken vertex colors in the game engine. --- .../Rasterizer/RAS_OpenGLRasterizer/RAS_StorageVA.cpp | 2 +- .../Rasterizer/RAS_OpenGLRasterizer/RAS_StorageVBO.cpp | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_StorageVA.cpp b/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_StorageVA.cpp index cf77ebfbeb9..316871e6025 100644 --- a/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_StorageVA.cpp +++ b/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_StorageVA.cpp @@ -171,7 +171,7 @@ void RAS_StorageVA::TexCoordPtr(const RAS_TexVert *tv) glVertexAttribPointerARB(unit, 4, GL_FLOAT, GL_FALSE, sizeof(RAS_TexVert), tv->getTangent()); break; case RAS_IRasterizer::RAS_TEXCO_VCOL: - glVertexAttribPointerARB(unit, 4, GL_UNSIGNED_BYTE, GL_FALSE, sizeof(RAS_TexVert), tv->getRGBA()); + glVertexAttribPointerARB(unit, 4, GL_UNSIGNED_BYTE, GL_TRUE, sizeof(RAS_TexVert), tv->getRGBA()); break; default: break; diff --git a/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_StorageVBO.cpp b/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_StorageVBO.cpp index cad5b5a508e..114defb60a5 100644 --- a/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_StorageVBO.cpp +++ b/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_StorageVBO.cpp @@ -149,6 +149,9 @@ void VBO::Draw(int texco_num, RAS_IRasterizer::TexCoGen* texco, int attrib_num, glVertexAttribPointerARB(unit, 4, GL_FLOAT, GL_FALSE, this->stride, this->tangent_offset); glEnableVertexAttribArrayARB(unit); break; + case RAS_IRasterizer::RAS_TEXCO_VCOL: + glVertexAttribPointerARB(unit, 4, GL_UNSIGNED_BYTE, GL_TRUE, this->stride, this->color_offset); + glEnableVertexAttribArrayARB(unit); default: break; } From 3f9b69287d287af09c801a5203be07287128b2a0 Mon Sep 17 00:00:00 2001 From: Brecht Van Lommel Date: Sun, 2 Oct 2016 15:43:02 +0200 Subject: [PATCH 25/25] Fluids: improve multithreaded CPU usage. Fixes for clamp-omp, fewer shared variables, fix some cases of threads writing to the same memory location. Issue found by Jens Verwiebe, who reports 30% speedup with 16 core CPU, when using this with a recent clang-omp version. --- intern/elbeem/intern/solver_class.h | 2 +- intern/elbeem/intern/solver_main.cpp | 29 +++++++++++++++++----------- 2 files changed, 19 insertions(+), 12 deletions(-) diff --git a/intern/elbeem/intern/solver_class.h b/intern/elbeem/intern/solver_class.h index 593fea1b998..2b2e214458d 100644 --- a/intern/elbeem/intern/solver_class.h +++ b/intern/elbeem/intern/solver_class.h @@ -332,7 +332,7 @@ class LbmFsgrSolver : void debugMarkCellCall(int level, int vi,int vj,int vk); // loop over grid, stream&collide update - void mainLoop(int lev); + void mainLoop(const int lev); // change time step size void adaptTimestep(); //! init mObjectSpeeds for current parametrization diff --git a/intern/elbeem/intern/solver_main.cpp b/intern/elbeem/intern/solver_main.cpp index 55a8d3eb4aa..a338bb77b4c 100644 --- a/intern/elbeem/intern/solver_main.cpp +++ b/intern/elbeem/intern/solver_main.cpp @@ -355,7 +355,7 @@ void LbmFsgrSolver::fineAdvance() //! fine step function /*****************************************************************************/ void -LbmFsgrSolver::mainLoop(int lev) +LbmFsgrSolver::mainLoop(const int lev) { // loops over _only inner_ cells ----------------------------------------------------------------------------------- @@ -376,13 +376,16 @@ LbmFsgrSolver::mainLoop(int lev) // main loop region const bool doReduce = true; const int gridLoopBound=1; + const int gDebugLevel = ::gDebugLevel; + int calcNumInvIfCells = 0; + LbmFloat calcInitialMass = 0; GRID_REGION_INIT(); #if PARALLEL==1 -#pragma omp parallel default(shared) num_threads(mNumOMPThreads) \ +#pragma omp parallel default(none) num_threads(mNumOMPThreads) \ reduction(+: \ calcCurrentMass,calcCurrentVolume, \ calcCellsFilled,calcCellsEmptied, \ - calcNumUsedCells ) + calcNumUsedCells,calcNumInvIfCells,calcInitialMass) GRID_REGION_START(); #else // PARALLEL==1 GRID_REGION_START(); @@ -468,7 +471,7 @@ LbmFsgrSolver::mainLoop(int lev) calcCurrentMass += iniRho; calcCurrentVolume += 1.0; calcNumUsedCells++; - mInitialMass += iniRho; + calcInitialMass += iniRho; // dont treat cell until next step continue; } @@ -479,7 +482,7 @@ LbmFsgrSolver::mainLoop(int lev) if(isnotValid) { // remove fluid cells, shouldnt be here anyway LbmFloat fluidRho = m[0]; FORDF1 { fluidRho += m[l]; } - mInitialMass -= fluidRho; + calcInitialMass -= fluidRho; const LbmFloat iniRho = 0.0; RAC(tcel, dMass) = RAC(tcel, dFfrac) = iniRho; RAC(tcel, dFlux) = FLUX_INIT; @@ -608,8 +611,8 @@ LbmFsgrSolver::mainLoop(int lev) // read distribution funtions of adjacent cells = stream step DEFAULT_STREAM; - if((nbored & CFFluid)==0) { newFlag |= CFNoNbFluid; mNumInvIfCells++; } - if((nbored & CFEmpty)==0) { newFlag |= CFNoNbEmpty; mNumInvIfCells++; } + if((nbored & CFFluid)==0) { newFlag |= CFNoNbFluid; calcNumInvIfCells++; } + if((nbored & CFEmpty)==0) { newFlag |= CFNoNbEmpty; calcNumInvIfCells++; } // calculate mass exchange for interface cells LbmFloat myfrac = RAC(ccel,dFfrac); @@ -809,7 +812,7 @@ LbmFsgrSolver::mainLoop(int lev) // fill if cells in inflow region if(myfrac<0.5) { mass += 0.25; - mInitialMass += 0.25; + calcInitialMass += 0.25; } const int OId = oldFlag>>24; const LbmVec vel(mObjectSpeeds[OId]); @@ -1013,7 +1016,7 @@ LbmFsgrSolver::mainLoop(int lev) if( (mass) <= (rho * ( -FSGR_MAGICNR)) ) { ifemptied = 1; } if(oldFlag & (CFMbndOutflow)) { - mInitialMass -= mass; + calcInitialMass -= mass; mass = myfrac = 0.0; iffilled = 0; ifemptied = 1; } @@ -1105,6 +1108,8 @@ LbmFsgrSolver::mainLoop(int lev) mNumFilledCells = calcCellsFilled; mNumEmptiedCells = calcCellsEmptied; mNumUsedCells = calcNumUsedCells; + mNumInvIfCells += calcNumInvIfCells; + mInitialMass += calcInitialMass; } @@ -1115,13 +1120,14 @@ LbmFsgrSolver::preinitGrids() const int lev = mMaxRefine; const bool doReduce = false; const int gridLoopBound=0; + const int gDebugLevel = ::gDebugLevel; // preinit both grids for(int s=0; s<2; s++) { GRID_REGION_INIT(); #if PARALLEL==1 -#pragma omp parallel default(shared) num_threads(mNumOMPThreads) \ +#pragma omp parallel default(none) num_threads(mNumOMPThreads) \ reduction(+: \ calcCurrentMass,calcCurrentVolume, \ calcCellsFilled,calcCellsEmptied, \ @@ -1155,10 +1161,11 @@ LbmFsgrSolver::standingFluidPreinit() const int lev = mMaxRefine; const bool doReduce = false; const int gridLoopBound=1; + const int gDebugLevel = ::gDebugLevel; GRID_REGION_INIT(); #if PARALLEL==1 -#pragma omp parallel default(shared) num_threads(mNumOMPThreads) \ +#pragma omp parallel default(none) num_threads(mNumOMPThreads) \ reduction(+: \ calcCurrentMass,calcCurrentVolume, \ calcCellsFilled,calcCellsEmptied, \