blender.git
2 months agoMSVC: add C4115 and C4189 warnings.
mano-wii [Fri, 22 Mar 2019 19:15:46 +0000 (16:15 -0300)]
MSVC: add C4115 and C4189 warnings.

This matches the warnings of the other compilers commonly used in Blender.

2 months agoRevert "Cleanup: remove legacy mesh save support"
Brecht Van Lommel [Fri, 22 Mar 2019 17:16:46 +0000 (18:16 +0100)]
Revert "Cleanup: remove legacy mesh save support"

Fixes T62793. Leave this in the blender2.7 branch for those that still rely
on it, but it will remain removed in master.

2 months agoFix T62844: Cycles crash with bevel and degenerate geometry.
Brecht Van Lommel [Fri, 22 Mar 2019 16:01:33 +0000 (17:01 +0100)]
Fix T62844: Cycles crash with bevel and degenerate geometry.

2 months agoFix cycles.merge_images not merging correctly for some channel layouts.
Brecht Van Lommel [Wed, 20 Mar 2019 17:38:02 +0000 (18:38 +0100)]
Fix cycles.merge_images not merging correctly for some channel layouts.

2 months agoCycles: make cycles.merge_images work with incomplete layers and passes.
Brecht Van Lommel [Wed, 20 Mar 2019 15:02:38 +0000 (16:02 +0100)]
Cycles: make cycles.merge_images work with incomplete layers and passes.

If layers and passes are not exactly the same in all files, we make a best
effort to merge them instead of failing.

2 months agoFix T62758: hair curves with UV mapped textures renders wrong.
Jacques Lucke [Wed, 20 Mar 2019 15:59:49 +0000 (16:59 +0100)]
Fix T62758: hair curves with UV mapped textures renders wrong.

Differential Revision: https://developer.blender.org/D4562

2 months agoCycles: Made Embree ignore curve intersections with SSS.
Stefan Werner [Wed, 20 Mar 2019 11:27:35 +0000 (12:27 +0100)]
Cycles: Made Embree ignore curve intersections with SSS.

2 months agoCycles: Performance optimization for Embree, resizing arrays once instead of per...
Stefan Werner [Wed, 20 Mar 2019 09:48:49 +0000 (10:48 +0100)]
Cycles: Performance optimization for Embree, resizing arrays once instead of per object.

2 months agoCleanup: fix debug warnign due to tooltip ending in dot.
Brecht Van Lommel [Tue, 19 Mar 2019 18:16:39 +0000 (19:16 +0100)]
Cleanup: fix debug warnign due to tooltip ending in dot.

2 months agoCycles: add cycles.merge_images operator for combing EXR renders.
Brecht Van Lommel [Tue, 19 Mar 2019 13:38:57 +0000 (14:38 +0100)]
Cycles: add cycles.merge_images operator for combing EXR renders.

This is only available through the API, mainly intended for render farms to
combine rendered multilayer EXR Files with different samples. The images are
currently expected to have the exact same render layers and passes, just with
different samples.

Variance passes are still simply a weighted average, ideally these should be
merged more intelligently.

Differential Revision: https://developer.blender.org/D4554

2 months agoCycles: Implement function to format and parse human readable time
Sergey Sharybin [Tue, 19 Mar 2019 14:19:22 +0000 (15:19 +0100)]
Cycles: Implement function to format and parse human readable time

Gives value in seconds for a string which is encoded in format HH:MM:SS.hh.

2 months agoFix Cycles curve UVs wrong after recent changes.
Brecht Van Lommel [Mon, 18 Mar 2019 17:51:24 +0000 (18:51 +0100)]
Fix Cycles curve UVs wrong after recent changes.

2 months agoFix T62712: Cycles world light path node not working.
Brecht Van Lommel [Mon, 18 Mar 2019 17:45:17 +0000 (18:45 +0100)]
Fix T62712: Cycles world light path node not working.

2 months agoFix AMD OpenCL build error after recent changes.
Brecht Van Lommel [Mon, 18 Mar 2019 15:36:55 +0000 (16:36 +0100)]
Fix AMD OpenCL build error after recent changes.

Always use native function since this was already the case due to
__CL_USE_NATIVE__ not being defined in time, and seems to have caused no
known issues.

2 months agoCleanup: fix compiler warnings.
Brecht Van Lommel [Mon, 18 Mar 2019 13:56:08 +0000 (14:56 +0100)]
Cleanup: fix compiler warnings.

2 months agoCycles: Cleanup strict compiler warnings
Sergey Sharybin [Mon, 18 Mar 2019 11:02:41 +0000 (12:02 +0100)]
Cycles: Cleanup strict compiler warnings

2 months agoCleanup: remove unused buildbot code.
Brecht Van Lommel [Sun, 17 Mar 2019 02:02:00 +0000 (03:02 +0100)]
Cleanup: remove unused buildbot code.

2 months agoFix Windows 32bit buildbot trying to use CUDA, should be disabled.
Brecht Van Lommel [Sun, 17 Mar 2019 01:56:22 +0000 (02:56 +0100)]
Fix Windows 32bit buildbot trying to use CUDA, should be disabled.

2 months agoCycles: optimization for constant background colors.
Brecht Van Lommel [Tue, 19 Feb 2019 16:44:58 +0000 (17:44 +0100)]
Cycles: optimization for constant background colors.

Skip shader evaluation then, as we already do for lights. Less than
1% faster in my tests, but might as well be consistent for both.

2 months agoFix Cycles OpenCL compile waiting unnecessarily for background shader.
Brecht Van Lommel [Sun, 17 Mar 2019 00:56:08 +0000 (01:56 +0100)]
Fix Cycles OpenCL compile waiting unnecessarily for background shader.

Makes preview kernel appear quicker when background color is fixed.

2 months agoCleanup: simplify kernel features definition.
Brecht Van Lommel [Sat, 16 Mar 2019 15:45:50 +0000 (16:45 +0100)]
Cleanup: simplify kernel features definition.

No functional changes, logic here got too complex after many changes over
the years.

2 months agoCleanup: remove Cycles advanced shading features toggle.
Brecht Van Lommel [Sat, 16 Mar 2019 15:06:36 +0000 (16:06 +0100)]
Cleanup: remove Cycles advanced shading features toggle.

It's effectively always enabled, only not on some unsupported OpenCL devices.
For testing those it's not useful to disable these features. This is replaced
by the more fine grained feature toggles that we have now.

2 months agoTests: remove unnecessary _test postfix on test names.
Brecht Van Lommel [Fri, 15 Mar 2019 18:11:33 +0000 (19:11 +0100)]
Tests: remove unnecessary _test postfix on test names.

2 months agoCycles: upgrade to CUDA 10.1 as the one officially supported version.
Brecht Van Lommel [Fri, 15 Mar 2019 13:18:22 +0000 (14:18 +0100)]
Cycles: upgrade to CUDA 10.1 as the one officially supported version.

This version fixes various bugs, and there is no need anymore to use both
9.1 and 10.0 for different cards.

There is a bug related to WITH_CYCLES_CUBIN_COMPILER and bump mapping in the
regression tests, so that remains disabled same as it was for CUDA 10.0.

Fix T59286: CUDA bake failing on some cards.
Fix T56858: CUDA 9.2 and 10 issues.

2 months agoFix cycles preferences.get_devices() not returning all devices as before.
Brecht Van Lommel [Fri, 15 Mar 2019 14:26:18 +0000 (15:26 +0100)]
Fix cycles preferences.get_devices() not returning all devices as before.

It only returned those for the active device type. For backwards compatibility
return them all again, but still avoid enumerating them from our own code on
startup or opening preferences.

2 months agoCycles/OpenCL: Compile Kernels During Scene Update
Jeroen Bakker [Wed, 13 Mar 2019 11:31:48 +0000 (12:31 +0100)]
Cycles/OpenCL: Compile Kernels During Scene Update

The main goals of this change is faster starting when using foreground
rendering.

This patch will build kernels in parallel to the update process of
the scene. When these optimized kernels are not available (yet) an AO
kernel will be used.

These AO kernels are fast to compile (3-7 seconds) and can be
reused by all scenes. When the final kernels become available we
will switch to these kernels.

In background mode the AO kernels will not be used.
Some kernels are being used during Scene update (displace, background
light). When these kernels are being used the process can halt until
these become available.

Reviewed By: brecht, #cycles

Maniphest Tasks: T61752

Differential Revision: https://developer.blender.org/D4428

2 months agoCycles/OpenCL: Added missing opencl programs
Jeroen Bakker [Fri, 15 Mar 2019 07:11:28 +0000 (08:11 +0100)]
Cycles/OpenCL: Added missing opencl programs

The functions that determine the program name + filename of kernels
were missing some base kernels like denoising and base. For completeness
I added those kernels so the function returns the correct results.

2 months agoFix T62120: number button editing outside of soft max range jumps.
Brecht Van Lommel [Thu, 14 Mar 2019 17:27:17 +0000 (18:27 +0100)]
Fix T62120: number button editing outside of soft max range jumps.

2 months agoFix T57138: Cycles CMJ failing with viewport samples set to 0.
Brecht Van Lommel [Thu, 14 Mar 2019 16:29:18 +0000 (17:29 +0100)]
Fix T57138: Cycles CMJ failing with viewport samples set to 0.

Can't use INT_MAX, CMJ runs into precision/overflow issues before that.

2 months agoCycles: Improved thread order for better CUDA performance.
Stefan Werner [Thu, 14 Mar 2019 10:45:58 +0000 (11:45 +0100)]
Cycles: Improved thread order for better CUDA performance.

This patch puts threads that render the same pixel closer together,
as opposed to threads that render the same sample. Thus threads
within a warp are more coherent in memory access and control flow,
leading to performance improvements.

Example benchmarks on a Quadro RTX4000 (WDDM) on Windows 10:
Koro:                 4:23 ->  3:46
BMW:                  1:18 ->  1:25
Barbershop Interior: 17:52 -> 14:55
Classroom:            4:37 ->  3:45

Performance differences on OpenCL/AMD were hit and miss, some scenes
became faster, others lost significantly. Therefore, this is kept as
CUDA only change for now.

2 months agoFix T62145: Geometry.Backface Node Renders Black
Jeroen Bakker [Thu, 14 Mar 2019 08:20:11 +0000 (09:20 +0100)]
Fix T62145: Geometry.Backface Node Renders Black

The NODE_GROUP_LEVEL of the Geometry node should be bumped to 1
when Backface is connected. Backface uses `NODE_LIGHT_PATH` that
is part of NODE_GROUP_LEVEL1, the rest of the geometry ndoe is
NODE_GROUP_LEVEL_0.

2 months agoBuild environment: require Alsa/OSS/PulseAudio backends for OpenAL on Linux.
Brecht Van Lommel [Wed, 13 Mar 2019 12:00:03 +0000 (13:00 +0100)]
Build environment: require Alsa/OSS/PulseAudio backends for OpenAL on Linux.

Otherwise we can silently build an OpenAL that can't actually playback audio.

2 months agoFix T60434: crash with OSL and viewport + preview render at the same time.
Brecht Van Lommel [Wed, 13 Mar 2019 17:26:11 +0000 (18:26 +0100)]
Fix T60434: crash with OSL and viewport + preview render at the same time.

Don't free LLVM JIT memory until process exit, there might be multiple OSL
instances using it.

2 months agoBuild environment: backport master changes to blender2.7.
Brecht Van Lommel [Wed, 13 Mar 2019 17:30:42 +0000 (18:30 +0100)]
Build environment: backport master changes to blender2.7.

We can keep these in sync for now.

2 months agoBuild environment: require Alsa/OSS/PulseAudio backends for OpenAL on Linux.
Brecht Van Lommel [Wed, 13 Mar 2019 12:00:03 +0000 (13:00 +0100)]
Build environment: require Alsa/OSS/PulseAudio backends for OpenAL on Linux.

Otherwise we can silently build an OpenAL that can't actually playback audio.

2 months agoFix T62481: Cycles crash rendering with UV pass after recent changes.
Brecht Van Lommel [Tue, 12 Mar 2019 13:03:05 +0000 (14:03 +0100)]
Fix T62481: Cycles crash rendering with UV pass after recent changes.

2 months agoCycles/OpenCL: Reduce How Often Kernel Recompilations Are Needed
Jeroen Bakker [Tue, 12 Mar 2019 12:58:39 +0000 (13:58 +0100)]
Cycles/OpenCL: Reduce How Often Kernel Recompilations Are Needed

This patch will reduce the number of times that we need to
recompile kernels. It does this by (en/dis)abling features
by default. So when the user needs them that the kernels are
already available.

Other features are enabled by default for background and foreground
rendering. When in background rendering the user wants the best
render performance. When in foreground rendering the user wants
the least amount of recompilations.

Enabling volumetrics or subdivision evaluation will still trigger
a recompilation during foreground rendering.

Reviewed By: #cycles, brecht

Differential Revision: https://developer.blender.org/D4485

2 months agoFix T61053: crash baking to float image after file save.
Brecht Van Lommel [Mon, 11 Mar 2019 10:09:14 +0000 (11:09 +0100)]
Fix T61053: crash baking to float image after file save.

This is the wrong flag to check, no other code actually reads it.

2 months agoFix T61103: Cycles bevel wrong on objects with negative scale.
Brecht Van Lommel [Mon, 11 Mar 2019 09:20:31 +0000 (10:20 +0100)]
Fix T61103: Cycles bevel wrong on objects with negative scale.

2 months agoFix T61831: Denoising Clean pass not scaled correctly with samples.
Brecht Van Lommel [Mon, 11 Mar 2019 08:13:46 +0000 (09:13 +0100)]
Fix T61831: Denoising Clean pass not scaled correctly with samples.

2 months agoColor management: Fix/workaround broken getDefaultDisplay()
Sergey Sharybin [Wed, 5 Dec 2018 12:34:04 +0000 (13:34 +0100)]
Color management: Fix/workaround broken getDefaultDisplay()

This is something what is caused by OCIO library. The patch
has been submitted there:

  https://github.com/imageworks/OpenColorIO/pull/638

For until it is refined and checked we do workaround from
our side.

2 months agoColor management: Query default view from display
Sergey Sharybin [Wed, 5 Dec 2018 11:06:48 +0000 (12:06 +0100)]
Color management: Query default view from display

Solves weird situation when default display name is queried
from OCIO, but Default view being assumed to be set for it.

Now view is initialized to a default view of that display.

2 months agoFix stashed full-screens returning to wrong layout
Julian Eisel [Sat, 9 Mar 2019 15:58:13 +0000 (16:58 +0100)]
Fix stashed full-screens returning to wrong layout

Steps to reproduce were:
* Maximize area (Shift+Spacebar in 2.7, Ctrl+Spacebar in 2.8)
* Open temp file browser (Ctrl+O)
* Cancel file browser (Esc) - should return to previous full-screen
* Press "Return to Previous" button
The previously maximized area would turn into a file-browser.

Note that the issue will still happen when opening old files saved while
in maximized area full-screen.

2 months agoCycles OpenCL: Remove single program
Jeroen Bakker [Fri, 8 Mar 2019 15:31:05 +0000 (16:31 +0100)]
Cycles OpenCL: Remove single program

Part of the cleanup of the OpenCL codebase.
Single program is not effective when using OpenCL, it is slower
to compile and slower during rendering (when used in for example
`barbershop` or `victor`).

Reviewers: brecht, #cycles

Maniphest Tasks: T62267

Differential Revision: https://developer.blender.org/D4481

2 months agocmake/windows: Set LLVM_INCLUDE_DIRS variable.
Ray Molenkamp [Fri, 8 Mar 2019 14:17:56 +0000 (07:17 -0700)]
cmake/windows: Set LLVM_INCLUDE_DIRS variable.

2 months agobuild_environment/Windows: Copy llvm debug headers.
Ray Molenkamp [Fri, 8 Mar 2019 13:59:54 +0000 (06:59 -0700)]
build_environment/Windows: Copy llvm debug headers.

llvm generates some header files at build time that differ between
debug/release causing linker errors when you used the release headers
for a debug build.

2 months agoCodestyle: comments
Jeroen Bakker [Fri, 8 Mar 2019 07:56:16 +0000 (08:56 +0100)]
Codestyle: comments

2 months agoFix Cycles build error on non-x86 processors.
Brecht Van Lommel [Wed, 6 Mar 2019 12:27:29 +0000 (13:27 +0100)]
Fix Cycles build error on non-x86 processors.

2 months agoCleanup: add asserts to catch cases where wrong attribute type is used.
Brecht Van Lommel [Tue, 5 Mar 2019 17:49:47 +0000 (18:49 +0100)]
Cleanup: add asserts to catch cases where wrong attribute type is used.

2 months agoFix Cycles bug rendering with multiple UV maps after recent changes.
Brecht Van Lommel [Tue, 5 Mar 2019 17:39:55 +0000 (18:39 +0100)]
Fix Cycles bug rendering with multiple UV maps after recent changes.

2 months agoCycles: Changed standalone XML parser to read UV as float2
Stefan Werner [Tue, 5 Mar 2019 14:25:36 +0000 (15:25 +0100)]
Cycles: Changed standalone XML parser to read UV as float2

2 months agoCycles: Added Float2 attribute type.
Brecht Van Lommel [Tue, 5 Mar 2019 13:54:54 +0000 (14:54 +0100)]
Cycles: Added Float2 attribute type.

Float2 are now a new type for attributes in Cycles. Before, the choices
for attribute storage were float and float3, the latter padded to
float4. This meant that UV maps were inflated to twice the size
necessary.

Reviewers: brecht, sergey

Reviewed By: brecht

Subscribers: #cycles

Tags: #cycles

Differential Revision: https://developer.blender.org/D4409

2 months agoFix T58953: Lamp data not always set
Jeroen Bakker [Tue, 5 Mar 2019 13:22:54 +0000 (14:22 +0100)]
Fix T58953: Lamp data not always set

The Lamp data was not always set. When using CUDA or CPU it was, but when using OpenCL
without `OBJECT_MOTION` `sd->lamp` not updated to the actual lamp. This made the
TextureCoordinate output the wrong normal when used in a light shader.

As the normal was incorrect it made the IES node render incorrectly.
(what is the default for the IES node).

By setting the lamp data when no `__OBJECT_MOTION__` compile directive is present makes
sure that the normal is correctly calculated.

Fix D4450

Reviewed By: Brecht van Lommel

2 months agoFixup for fix for OSX build using a build folder name with spaces
Dalai Felinto [Fri, 1 Mar 2019 20:07:06 +0000 (17:07 -0300)]
Fixup for fix for OSX build using a build folder name with spaces

Bug introduced on: 1f22e3f311e74031c3c01714117d759d3e3de3f1.
This was making regular Mac builds to fail, where they were not failing before.

Tested by William Reynish.

2 months agoFix missing image editor redraw when reloading image through API.
Brecht Van Lommel [Mon, 4 Mar 2019 15:04:24 +0000 (16:04 +0100)]
Fix missing image editor redraw when reloading image through API.

2 months agoFix Cycles animation denoising giving black pixels for some outliers.
Brecht Van Lommel [Mon, 4 Mar 2019 15:01:11 +0000 (16:01 +0100)]
Fix Cycles animation denoising giving black pixels for some outliers.

The denoising code expects the output buffer to be filled with the noisy
image, which was not the case for standalone denoising.

2 months agoFix bad level calls
Sergey Sharybin [Mon, 4 Mar 2019 10:58:37 +0000 (11:58 +0100)]
Fix bad level calls

2 months agoFix T62073: Cycles random hangs rendering with Save Buffers on.
Brecht Van Lommel [Fri, 1 Mar 2019 18:09:17 +0000 (19:09 +0100)]
Fix T62073: Cycles random hangs rendering with Save Buffers on.

2 months agoFix macOS OpenMP build error when using a build folder name with spaces.
Brecht Van Lommel [Thu, 28 Feb 2019 23:25:53 +0000 (00:25 +0100)]
Fix macOS OpenMP build error when using a build folder name with spaces.

Patch by Campbell.

2 months agoFix Cycles animation denoising not working for files on a network drive.
Brecht Van Lommel [Thu, 28 Feb 2019 18:15:40 +0000 (19:15 +0100)]
Fix Cycles animation denoising not working for files on a network drive.

Can't do cross-device renaming, so put temporary file in same folder as
output file.

2 months agoCleanup: prevent future issues with ID.tag overflow, clarify somes names.
Brecht Van Lommel [Tue, 26 Feb 2019 13:14:56 +0000 (14:14 +0100)]
Cleanup: prevent future issues with ID.tag overflow, clarify somes names.

2 months agoCleanup: remove unnecessary assert.
Brecht Van Lommel [Tue, 26 Feb 2019 18:59:51 +0000 (19:59 +0100)]
Cleanup: remove unnecessary assert.

2 months agoCycles: Fix build error
Ray Molenkamp [Tue, 26 Feb 2019 15:32:41 +0000 (08:32 -0700)]
Cycles: Fix build error

introduced by rBdabe5cd31add8aa55b9ad4bce1b591ed4e98f1a1

2 months agoT61971: Compilation Displacement/Background Kernel
Jeroen Bakker [Tue, 26 Feb 2019 13:05:54 +0000 (14:05 +0100)]
T61971: Compilation Displacement/Background Kernel

Displacement and Background kernels are selectively used, but always compiled. This patch will not compile these kernels when they are not needed.

Displacement kernel is only used for true displacement.
Background kernel is only used when there is a (Cycles)Light of type `LIGHT_BACKGROUND`.

Reviewed By: brecht, #cycles

Tags: #cycles

Maniphest Tasks: T61971

Differential Revision: https://developer.blender.org/D4412

2 months agoT61576: Do Not (Re-)Compile OpenCL kernels
Jeroen Bakker [Tue, 26 Feb 2019 07:53:47 +0000 (08:53 +0100)]
T61576: Do Not (Re-)Compile OpenCL kernels

The goal of this patch is to have limit the number of times
kernels needs to be compiled and are reused as kernels with
different compile directives can lead to identical same
binaries.

The implementation does this by stripping the compile directives.
and reshuffling kernels so the output is more likely to be the
same.

We focussed on the kernels where it was easy to detect and maintain
(bundle, bake, displace, do_volume and background). More optimizations
could be done but they are probably less obvious.

Merged the data_init and state_buffer_size kernels to split_bundle.

This patch will also remove empty kernels for do_volume and bake
when their features are not enabled.

When using the benchmark files there are less background, bake and
do_volume kernels compiled.

Fix: T61576, T61501, T61466

Reviewed By: brecht, #cycles

Differential Revision: https://developer.blender.org/D4390

2 months agoFix T61946: Cycles border render missing samples and crypto metadata.
Brecht Van Lommel [Mon, 25 Feb 2019 18:51:36 +0000 (19:51 +0100)]
Fix T61946: Cycles border render missing samples and crypto metadata.

2 months agoFix T61891: Cycles light use nodes button greyed out.
Brecht Van Lommel [Mon, 25 Feb 2019 09:24:40 +0000 (10:24 +0100)]
Fix T61891: Cycles light use nodes button greyed out.

3 months agomake.bat: Preliminary Visual Studio 2019 support.
Ray Molenkamp [Sat, 23 Feb 2019 03:49:22 +0000 (20:49 -0700)]
make.bat: Preliminary Visual Studio 2019 support.

VS2019 is binary compatible with the existing vc14 libraries and no
new libraries libs are required in svn.

VS2019 support requires cmake 3.14.

VS2019 is still in pre-release state, you are required to explicitly
select the pre-release version by using:

make full 2019pre

3 months agoMake.bat: Fix sub-module detection
Ray Molenkamp [Sat, 23 Feb 2019 03:02:45 +0000 (20:02 -0700)]
Make.bat: Fix sub-module detection

3 months agoFix previous commit
Sergey Sharybin [Fri, 22 Feb 2019 14:52:42 +0000 (15:52 +0100)]
Fix previous commit

Somehow quote got missing the last moment.

3 months agoAlways show version when running in background mode
Sergey Sharybin [Fri, 22 Feb 2019 14:47:54 +0000 (15:47 +0100)]
Always show version when running in background mode

The goal is to make it easy to know which exact blender version
and built was used for a job on a farm. This includes but not
exclusively render farms. But same is handy for simulation tasks
as well.

3 months agoWindows: Use static pthreads library.
Ray Molenkamp [Thu, 21 Feb 2019 21:16:26 +0000 (14:16 -0700)]
Windows: Use static pthreads library.

3 months agoFix T61810: Cycles OpenCL denoising broken after recent changes.
Brecht Van Lommel [Thu, 21 Feb 2019 15:46:42 +0000 (16:46 +0100)]
Fix T61810: Cycles OpenCL denoising broken after recent changes.

3 months agoCycles OpenCL: Motion Blur Compile Directives
Jeroen Bakker [Thu, 21 Feb 2019 12:31:52 +0000 (13:31 +0100)]
Cycles OpenCL: Motion Blur Compile Directives

When using preview rendering through a camera or final rendering
the `scene.render.use_motion_blur` was not respected when building
the compile directives.

This patch will when building the compile directives check if
motion blur is enabled at all. This should lead to more efficient
kernels when no motion blur is needed.

Tags: #cycles

Differential Revision: https://developer.blender.org/D4387

3 months agoFix T61802: EXR preview JPEGs don't have the correct color
Sergey Sharybin [Thu, 21 Feb 2019 14:29:02 +0000 (15:29 +0100)]
Fix T61802: EXR preview JPEGs don't have the correct color

Missing color management, probably from the very beginnings of
the OCIO integration.

3 months agoFix: Missing closing brackets in include
Jeroen Bakker [Thu, 21 Feb 2019 13:36:51 +0000 (14:36 +0100)]
Fix: Missing closing brackets in include

3 months agoFix T61733: wrong alpha for sequencer screen, multiply, .. blend modes.
John Quillan [Thu, 21 Feb 2019 12:26:22 +0000 (13:26 +0100)]
Fix T61733: wrong alpha for sequencer screen, multiply, .. blend modes.

It was copying the alpha from the foreground instead of background image,
which is not usually what is needed and inconsistent with the compositor.

Differential Revision: https://developer.blender.org/D4371

3 months agoCodestyle: Indentation
Jeroen Bakker [Thu, 21 Feb 2019 07:52:04 +0000 (08:52 +0100)]
Codestyle: Indentation

3 months agoFix: OpenCL Displacement and light sampling
Jeroen Bakker [Thu, 21 Feb 2019 07:11:02 +0000 (08:11 +0100)]
Fix: OpenCL Displacement and light sampling

The bake kernels are also used during mesh displacement and light
importance sampling. We disabled the implementation of these kernels
when baking was not enabled.

3 months agoCycles: Fix uninitialized number of hits
Sergey Sharybin [Wed, 20 Feb 2019 22:15:21 +0000 (23:15 +0100)]
Cycles: Fix uninitialized number of hits

Was happening when looking for all intersections for transparent shadow rays
in the case the ray is degenerate.

Still quesitonable whether we should consider this a transparent or opaque
configuraiton. Ideally, we should prevent such rays from happening, but that
is another vector of debugging.

3 months agoTests: only run OpenGL draw tests on lib/tests/opengl, support symlinks.
Brecht Van Lommel [Wed, 20 Feb 2019 15:03:13 +0000 (16:03 +0100)]
Tests: only run OpenGL draw tests on lib/tests/opengl, support symlinks.

To keep running these tests relatively fast and practical to run often,
running it on all .blend files is a bit much. So now we only run it on
files from this directory.

Additionally this adds supports for following symlinks, so that you can
easily symlinks to other directories if you want to tests extra files
which may have linked libraries.

3 months agoCleanup: fix compiler warning.
Brecht Van Lommel [Wed, 20 Feb 2019 15:32:06 +0000 (16:32 +0100)]
Cleanup: fix compiler warning.

3 months agoCycles OpenCL: Remove OpenCL MegaKernel
Jeroen Bakker [Wed, 20 Feb 2019 13:41:56 +0000 (14:41 +0100)]
Cycles OpenCL: Remove OpenCL MegaKernel

Using OpenCL MegaKernel has been slow and therefore not usefull.
This patch will remove the mega kernel from the OpenCL codebase
and the OpenCLDeviceBase class.

T61736: removal of mega kernel
T61703: baking does not work with mega kernel

Tags: #cycles

Differential Revision: https://developer.blender.org/D4383

3 months agoT61463: Separate Baking kernels
Jeroen Bakker [Tue, 19 Feb 2019 15:31:31 +0000 (16:31 +0100)]
T61463: Separate Baking kernels

Cycles OpenCL: Split baking kernels in own program

Fix T61463. Before this patch baking was part of the base kernels. There
are 3 baking kernels that and all 3 uses shader evaluation. Only for one
of these kernels the functionality was wrapped in the __NO_BAKING__
compile directive.

When you start baking this leads to long compile times. By separating
in individual programs will reduce the compile times.

Also wrapped all baking kernels with __NO_BAKING__ to reduce the
compilation times.

Impact on compilation time

    job   |   scene_name    | previous |  new  | percentage
  --------+-----------------+----------+-------+------------
   T61463 | empty           |    10.63 |  7.27 |         32%
   T61463 | bmw             |    17.91 | 14.24 |         20%
   T61463 | fishycat        |    19.57 | 15.08 |         23%
   T61463 | barbershop      |    54.10 | 48.18 |         11%
   T61463 | classroom       |    17.55 | 14.42 |         18%
   T61463 | koro            |    18.92 | 17.15 |          9%
   T61463 | pavillion       |    17.43 | 14.23 |         18%
   T61463 | splash279       |    16.48 | 15.33 |          7%
   T61463 | volume_emission |    36.22 | 34.19 |          6%

Impact on render time

    job   |   scene_name    | previous |   new   | percentage
  --------+-----------------+----------+---------+------------
   T61463 | empty           |    21.06 |   20.54 |          2%
   T61463 | bmw             |   198.44 |  189.59 |          4%
   T61463 | fishycat        |   394.20 |  388.50 |          1%
   T61463 | barbershop      |  1188.16 | 1185.49 |          0%
   T61463 | classroom       |   341.08 |  339.27 |          1%
   T61463 | koro            |   472.43 |  360.70 |         24%
   T61463 | pavillion       |   905.77 |  902.14 |          0%
   T61463 | splash279       |    55.26 |   54.92 |          1%
   T61463 | volume_emission |    62.59 |   39.09 |         38%

I don't have a grounded explanation why koro and volume_emission is this much
faster; I have done several tests though...

Maniphest Tasks: T61463

Differential Revision: https://developer.blender.org/D4376

3 months agoT61513: Refactored Cycles Attribute Retrieval
Jeroen Bakker [Tue, 19 Feb 2019 14:41:22 +0000 (15:41 +0100)]
T61513: Refactored Cycles Attribute Retrieval

There is a generic function to retrieve float and float3 attributes
`primitive_attribute_float` and primitive_attribute_float3`. Inside
these functions an prioritised if-else construction checked where
the attribute is stored and then retrieved from that location.

Actually the calling function most of the time already knows where
the data is stored. So we could simplify this by splitting these
functions and remove the check logic.

This patch splits the `primitive_attribute_float?` functions into
`primitive_surface_attribute_float?` and `primitive_volume_attribute_float?`.
What leads to less branching and more optimum kernels.

The original function is still being used by OSL and `svm_node_attr`.

This will reduce the compilation time and render time for kernels.
Especially in production scenes there is a lot of benefit.

Impact in compilation times

    job  |   scene_name    | previous |  new  | percentage
  -------+-----------------+----------+-------+------------
  t61513 | empty           |    10.63 | 10.66 |          0%
  t61513 | bmw             |    17.91 | 17.65 |          1%
  t61513 | fishycat        |    19.57 | 17.68 |         10%
  t61513 | barbershop      |    54.10 | 24.41 |         55%
  t61513 | classroom       |    17.55 | 16.29 |          7%
  t61513 | koro            |    18.92 | 18.05 |          5%
  t61513 | pavillion       |    17.43 | 16.52 |          5%
  t61513 | splash279       |    16.48 | 14.91 |         10%
  t61513 | volume_emission |    36.22 | 21.60 |         40%

Impact in render times

    job  |   scene_name    | previous |  new   | percentage
  -------+-----------------+----------+--------+------------
  61513 | empty           |    21.06 |  20.35 |          3%
  61513 | bmw             |   198.44 | 190.05 |          4%
  61513 | fishycat        |   394.20 | 401.25 |         -2%
  61513 | barbershop      |  1188.16 | 912.39 |         23%
  61513 | classroom       |   341.08 | 340.38 |          0%
  61513 | koro            |   472.43 | 471.80 |          0%
  61513 | pavillion       |   905.77 | 899.80 |          1%
  61513 | splash279       |    55.26 |  54.86 |          1%
  61513 | volume_emission |    62.59 |  61.70 |          1%

There is also a possitive impact when using CPU and CUDA, but they are small.

I didn't split the hair logic from the surface logic due to:

* Hair and surface use same attribute types. It was not clear if it could be
  splitted when looking at the code only.
* Hair and surface are quick to compile and to read. So the benefit is quite
  small.

Differential Revision: https://developer.blender.org/D4375

3 months agoFix Cycles OpenCL multithreaded compilation not working on Windows.
Brecht Van Lommel [Tue, 19 Feb 2019 12:48:29 +0000 (13:48 +0100)]
Fix Cycles OpenCL multithreaded compilation not working on Windows.

3 months agoRevert "Cycles: Change OpenCL split kernel to use single program by default"
Jeroen Bakker [Fri, 15 Feb 2019 09:43:26 +0000 (10:43 +0100)]
Revert "Cycles: Change OpenCL split kernel to use single program by default"

This reverts commit c6bf5d47240cebef356276e369881e855dbe7e6d.

Related to D2264: When multi process opencl kernel compilation is in place single-program compiles slower then multi-program. c6bf5d47240cebef356276e369881e855dbe7e6d was created as single-program compiled faster, but this is not the case anymore. So let's revert this change. Production scenes like victor and barbershop even render quicker.

Change in Cycles OpenCL compilation times

>    job    |   scene_name    | compilation_time | render_time
>  Baseline | empty           |            22.73 |       20.63
>  T61514   | empty           |            10.63 |       21.06
>  Baseline | bmw             |            56.44 |      191.00
>  T61514   | bmw             |            17.91 |      198.44
>  Baseline | fishycat        |            59.50 |      393.48
>  T61514   | fishycat        |            19.57 |      394.20
>  Baseline | barbershop      |           212.28 |     1623.53
>  T61514   | barbershop      |            54.10 |     1188.16
>  Baseline | victor          |            67.51 |     1459.80
>  T61514   | victor          |            22.06 |     1381.58
>  Baseline | classroom       |            51.46 |      341.23
>  T61514   | classroom       |            17.55 |      341.08
>  Baseline | koro            |            62.48 |      475.96
>  T61514   | koro            |            18.92 |      472.43
>  Baseline | pavillion       |            54.37 |      903.48
>  T61514   | pavillion       |            17.43 |      905.77
>  Baseline | splash279       |            47.43 |       52.92
>  T61514   | splash279       |            16.48 |       55.26
>  Baseline | volume_emission |           145.22 |       62.38
>  T61514   | volume_emission |            36.22 |       62.59

Reviewers: #cycles, brecht, sergey

Reviewed By: #cycles, brecht

Differential Revision: https://developer.blender.org/D4349

3 months agoFix T54504: Cycles wrong backwards compatibility with linked libraries.
Brecht Van Lommel [Sun, 17 Feb 2019 11:27:07 +0000 (12:27 +0100)]
Fix T54504: Cycles wrong backwards compatibility with linked libraries.

The code assumed all datablocks were read from .blend files saved with the
same version. This restructures the Cycles versioning code to take into
account libraries.

3 months agoBlenlib/Windows: Fix Build error with clang.
Ray Molenkamp [Sat, 16 Feb 2019 18:42:55 +0000 (11:42 -0700)]
Blenlib/Windows: Fix Build error with clang.

__cpuid comes from intrin.h which was implicitly included somewhere
for msvc builds, but not for clang.

3 months agoWindows: Fix building with llvm/clang 7.0.1
Ray Molenkamp [Sat, 16 Feb 2019 18:36:19 +0000 (11:36 -0700)]
Windows: Fix building with llvm/clang 7.0.1

For llvm 6 the visual studio integration was 'not great' and we had
our own, which broke when llvm 7.0.1 came out. llvm now has properly
supported integration available on the VS market place hence we can
retire our custom support.

3 months agoCycles: Support multithreaded compilation of kernels
Brecht Van Lommel [Fri, 15 Feb 2019 07:18:38 +0000 (08:18 +0100)]
Cycles: Support multithreaded compilation of kernels

This patch implements a workaround to get the multithreaded compilation from D2231 working.
So far, it only works for Blender, not for Cycles Standalone. Also, I have only tested the Linux codepath in the helper function.
Depends on D2231.

Patch by lukasstockner97, jbakker, brecht

    job    |   scene_name    | compilation_time
----------+-----------------+------------------
    Baseline | empty           |            22.73
    D2264    | empty           |            13.94
    Baseline | bmw             |            56.44
    D2264    | bmw             |            41.32
    Baseline | fishycat        |            59.50
    D2264    | fishycat        |            45.19
    Baseline | barbershop      |           212.28
    D2264    | barbershop      |           169.81
    Baseline | victor          |            67.51
    D2264    | victor          |            53.60
    Baseline | classroom       |            51.46
    D2264    | classroom       |            39.02
    Baseline | koro            |            62.48
    D2264    | koro            |            49.03
    Baseline | pavillion       |            54.37
    D2264    | pavillion       |            38.82
    Baseline | splash279       |            47.43
    D2264    | splash279       |            37.94
    Baseline | volume_emission |           145.22
    D2264    | volume_emission |           121.10

This patch reduced compilation time as the split kernels and base
kernels are compiled in parallel. In cycles debug mode (256) you can set
unmark the opencl single program file, what reduces the compilation time
even further (bmw 17 seconds, barbershop 53 seconds).

Reviewers: brecht, dingto, sergey, juicyfruit, lukasstockner97

Reviewed By: brecht

Subscribers: Loner, jbakker, candreacchio, 3dLuver, LazyDodo, bliblubli

Differential Revision: https://developer.blender.org/D2264

3 months agoCleanup: fix compiler warnings.
Brecht Van Lommel [Thu, 14 Feb 2019 18:28:19 +0000 (19:28 +0100)]
Cleanup: fix compiler warnings.

3 months agoFix T61470: incorrect saturation clamping in recent bugfix.
Brecht Van Lommel [Thu, 14 Feb 2019 18:03:59 +0000 (19:03 +0100)]
Fix T61470: incorrect saturation clamping in recent bugfix.

We should clamp the result after multiplication.

3 months agoFix Cycles Embree crash on macOS, due to too small thread stack size.
Brecht Van Lommel [Thu, 14 Feb 2019 13:37:57 +0000 (14:37 +0100)]
Fix Cycles Embree crash on macOS, due to too small thread stack size.

3 months agoFix Cycles build error with OpenImageIO 2.x.
Brecht Van Lommel [Thu, 14 Feb 2019 12:57:28 +0000 (13:57 +0100)]
Fix Cycles build error with OpenImageIO 2.x.

3 months agoFix T61470: inconsistent HSV node results with saturation > 1.0.
Brecht Van Lommel [Wed, 13 Feb 2019 15:58:54 +0000 (16:58 +0100)]
Fix T61470: inconsistent HSV node results with saturation > 1.0.

Values outside the 0..1 range produce negative colors, so now clamp to that
range everywhere. Also fixes improper handling of hue > 2.0 in some places.

3 months agoFix T61502: Cycles wrong other object texture coordinates in OSL.
Brecht Van Lommel [Wed, 13 Feb 2019 14:01:54 +0000 (15:01 +0100)]
Fix T61502: Cycles wrong other object texture coordinates in OSL.

The row/column major matrix conversion was done twice.

3 months agoFix T61457, T61489, T61482: build errors and memory warning in Cycles.
Brecht Van Lommel [Tue, 12 Feb 2019 16:10:31 +0000 (17:10 +0100)]
Fix T61457, T61489, T61482: build errors and memory warning in Cycles.

For OIIO 2.x we must use unique_ptr. This also required updating the
guarded allocator for std::move to work. Since C++11 construct/destroy
have a default implementation that also works this case, so we just
leave it out.

3 months agoCycles: add animation denoising test, fix operator to work with single frames.
Brecht Van Lommel [Mon, 11 Feb 2019 17:26:47 +0000 (18:26 +0100)]
Cycles: add animation denoising test, fix operator to work with single frames.

3 months agoCycles: backport samples metadata format changes to 2.7.
Sergey Sharybin [Wed, 6 Feb 2019 10:49:41 +0000 (11:49 +0100)]
Cycles: backport samples metadata format changes to 2.7.

The render layer name is now always included. Best to keep these consistent,
so that animation denoising and sample merging works the same for both and
tests can be the same. Ref D4311.