Commit Graph

5697 Commits

Author SHA1 Message Date
Bastien Montagne
7e9103b49c atomic_ops: add atomic_fetch_and_and_uint8 wrapper.
Needed by incomming changes in pbvh.c.

Note that we make it much simpler than for other primitives in this file - think
we could revise its content to make it simpler one day...
2016-01-27 12:26:00 +01:00
Sergey Sharybin
8126b0222d Fix T47214: Keyed Particles don't render correctly when used for point density input
The issue was caused by different AABB used by Cycles and texture sampler.

Instead of trying to keep this two functions in sync we now do have an
utility call in the point density node to query the AABB.
2016-01-26 12:50:55 +01:00
Sergey Sharybin
c8d2ebe13c Compositor: Speedup movie (un)distortion operation
Avoid per-pixel camera intrincs object construction and synchronization.

Here on a bit synthetic file it gives about 40% speedup with a single node.
2016-01-26 11:44:43 +01:00
Thomas Dinges
780e900a0d Cycles: Tweak Cycles samples again.
Now we use 128 for final, and 32 for preview. These values should be a bit
better (power of two, also faster with CMJ).
2016-01-24 13:32:20 +01:00
Sergey Sharybin
9163fc05a7 Cycles: Fix typo in flags check 2016-01-24 17:05:02 +05:00
Thomas Dinges
35c3e7b522 Cleanup: Remove outdated comment in volume code.
Thanks to jesterking for finding this one.
2016-01-24 12:31:36 +01:00
Campbell Barton
3174254142 Cleanup: style 2016-01-24 12:13:37 +11:00
Sergey Sharybin
b42878012c Cycles: Make Clang 3.6 happy with const debug flags reference
For some reason it did not like the explicit const qualifier for a
custom type.
2016-01-24 01:33:53 +05:00
Kévin Dietrich
e9452f909c Implementation of OpenVDB as a possible cache format for smoke
simulations.

This commits implements OpenVDB as an extra cache format in the Point
Cache system for smoke simulations. Compilation with the library is
turned off by default for now, and shall be enabled when the library is
present.

A documentation of its doings is available here: http://
wiki.blender.org/index.php/User:Kevindietrich/OpenVDBSmokeExport.

A guide to compile OpenVDB can be found here (Linux): http://
wiki.blender.org/index.php?title=Dev:Doc/Building_Blender/Linux/
Dependencies_From_Source#OpenVDB

Reviewers: sergey, lukastoenne, brecht, campbellbarton

Reviewed By: brecht, campbellbarton

Subscribers: galenb, Blendify, robocyte, Lapineige, bliblubli,
jtheninja, lukasstockner97, dingto, brecht

Differential Revision: https://developer.blender.org/D1721
2016-01-23 08:39:40 +01:00
Thomas Dinges
456e7be9d2 Cycles: Change several default values (first batch).
This changes the following defaults:

- Render settings:

  * Samples: 100
  * Preview Samples: 50
  * Filter: Blackmann-Harris
  * Tile Order: Hilbert Spiral

- Lamp settings:

  * Use MIS: On

- Material settings:

  * Volume Sampling: Multiple Importance

Old files are not affected, I tested the versioning code back and forth.
More changes are to come (World, BVH...) but that needs a bit more work.
2016-01-22 23:19:23 +01:00
Martijn Berger
7788681eda MS Visual Studio 2015 does not find std::inserter 2016-01-21 17:21:32 +01:00
Thomas Dinges
adcef2bd36 Cycles: Improve UI feedback for light samples.
Fix T47213.
There was actually no real bug here, just clarify now in the UI that Mesh, World and Lamp samples only have an effect if we sample all lights (direct or indirect).
2016-01-21 09:02:49 +01:00
Bastien Montagne
54d3506253 Fix error in rBa6eae7339190. 2016-01-20 14:54:57 +01:00
Sergey Sharybin
a6eae73391 Fix (partial) T47198: Cycles have broken UVs in some degenerated quads cases
The issue was discontinuity in logic when importing vertices from blender
and then importing data layers regardless of how we split the face. Quite
interesting we didn't notice this issue before.

Thanks Bastien for the investigation, based on D1742 but redid it to make
patch a bit more clear to follow.
2016-01-20 09:13:04 +01:00
Sergey Sharybin
19adfd3176 Cycles: Fix OpenCL kernel compilation after the bake commit
There is no function pointers in OpenCL specification. For as long
as we want to support this platform we should follow the specifications.

While the code is not totally optimal now, it should not be that huge
of performance issue on CPU since it does jump tables just nicely, so
it's not that much extra computation here.
2016-01-19 22:53:19 +01:00
Sergey Sharybin
52e34ffe33 Cycles: Pass missing shader filter argument to CUDA and OpenCL kernels 2016-01-19 22:53:19 +01:00
Sergey Sharybin
e5904f3eea Cycles: Add a debug flag to disable QBVH 2016-01-19 18:38:41 +01:00
Sergey Sharybin
d44ea880ea Fix T47201: Cycles+OSL keeps image files open until Blender exits
Now image will be opened for while render session is active, this is
needed to keep image cache working correctly. But stopping render
should now release all files descriptors.
2016-01-19 14:56:52 +05:00
Sergey Sharybin
df465368ba Libmv: Solve some strict warnings in tests 2016-01-19 14:06:25 +05:00
Sergey Sharybin
1c71b8e323 Cycles: Fix compilation with older OSL
We didn't switch to OSL-1.6.9 on all platforms yet,
so please keep codeabse compiled with 1.5 for the
time being.
2016-01-16 22:47:04 +05:00
Sergey Sharybin
36aa7e659e Fix T47180: Cycles deform motion blur + displacement behaves weirdly
Displacement shader was not updating motion vertex positions.

Current solution is not totally correct because it applies same offset
for all time steps. Ideally we'll need to evaluate displacement shader
for every time offset separately, but currently we don't have subframe
image access.

For the time being will consider this a TODO.
2016-01-16 15:36:42 +05:00
Lukas Stockner
70e16b3c99 Fix T47181: Blender OSL script node crash (OSL 1.6.9)
Compiling OSL scripts with errors in them would cause Blender to crash since the OSL version
bump to 1.6.9 instead of printing the error to the console as it did before.

With version 1.6.2, OSL added a pointer to an OpenImageIO ErrorHandler as an argument to the
OSLCompiler constructor. However, since it defaults to the NULL pointer, Blender still compiled
fine after the OSL version bump.
It turns out, though, that this pointer is used without further checks inside the OSL code, which
makes it crash when it tries to report an error unless a valid ErrorHandler pointer is specified.
Therefore, this commit simply passes a pointer to the static default handler that OIIO offers,
which prints the error to the console just like OSL did before.

Using this feature for a more advanced error handling and displaying from the Blender side would
be possible and seems reasonable, but for now it's not really relevant for fixing this bug.
2016-01-16 01:32:22 +01:00
Dalai Felinto
9a76354585 Cycles-Bake: Custom Baking passes
The combined pass is built with the contributions the user finds fit.

It is useful for lightmap baking, as well as non-view dependent effects
baking.

The manual will be updated once we get closer to the 2.77 release.
Meanwhile the new page can be found here:

http://dalaifelinto.com/blender-manual/render/cycles/baking.html

Reviewers: sergey, brecht

Differential Revision: https://developer.blender.org/D1674
2016-01-15 13:00:56 -02:00
Campbell Barton
d21eeffbbf Cleanup: used pre-defined atoms in ghost 2016-01-15 18:40:15 +11:00
Campbell Barton
c282373116 Fix T31063: X11 window resize fails on PPC
X11 property access was using wrong sized types that only worked for little endian systems.
2016-01-15 16:47:41 +11:00
Bastien Montagne
2fb3fa1bf1 Usual fixes and tweaks for UI messages. 2016-01-14 17:00:16 +01:00
Sergey Sharybin
8f3bb8d578 Cycles: One more attempt to fix issue mentioned in previous commit 2016-01-14 19:12:11 +05:00
Sergey Sharybin
a4625b910f Cycles: Fix typo in the debug panel commit 2016-01-14 19:07:06 +05:00
Sergey Sharybin
55926ad298 Cycles: Fix string compiler warnings after recent changes 2016-01-14 17:04:56 +05:00
Sergey Sharybin
c9365e25a9 Cycles: Cleanup, spelling and indentation 2016-01-14 17:01:56 +05:00
Thomas Dinges
3ba9742be2 Cycles: Remove the experimental CUDA kernel.
This commit removes the experimental CUDA kernel, making SSS and CMJ
regular features.

Several improvements have been made in the past few
weeks (thanks Sergey!) which make SSS render several times faster (2-3x
compared to 2.76b) on the GPU, and the increased VRAM usage has also been
fixed. Therefore the experimental kernel is no longer needed.

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

Manual has been updated: too:
https://www.blender.org/manual/render/cycles/features.html
2016-01-14 12:56:08 +01:00
Sergey Sharybin
73feae6f5d Libmv: Solve strict compiler warnings in stubs 2016-01-14 15:56:05 +05:00
Sergey Sharybin
1f273cec00 Cycles: Tweak inline policy for some functions
The goal is to make Experimental kernel closer in performance to the
official kernel, avoiding spills and such.

There should not be big impact on official kernel, own tests showed
few percent performance drop on laptop's GPU. CPU was always the
same speed on AVX, AVX2 and SSE4.1 CPUs i've been testing here.

This seems to be the last essential step before we can get rid of
Experimental kernel and enable SSS officially on GPU without causing
some major performance issues.

Surely some more tweaks are possibly required, but that we can do
for until cows go home anyway.
2016-01-14 14:53:05 +05:00
Sergey Sharybin
5af103fe00 Cycles: Reduce scope of some defines set in CMakeLists
Should be no functional changes at all, just speeds up re-compilation
when some features needs to be disabled for development purposes.

For example, when running lots of Valgrind it's handy to disable any
GPU devices because otherwise you'll be wasting quite some time in
the driver while enumerating devices.

Reviewers: dingto, lukasstockner97, brecht, juicyfruit

Differential Revision: https://developer.blender.org/D1730
2016-01-14 13:12:50 +05:00
Sergey Sharybin
d3c55337d3 CMake: Fix typo in CUDA dynload commit 2016-01-14 12:48:14 +05:00
Sergey Sharybin
90e827ba66 CMake: De-duplicate checks around unordered maps and shared pointer
Previously several areas were calling TEST_SHARED_PTR_SUPPORT and
TEST_UNORDERED_MAP_SUPPORT which isn't that bad on it's own but
was causing some quite verbose output with same information line
printed multiple times. additionally, what's more worse, define flags
for Ceres were duplicated in main CMakeLists and Ceres's CMakeLists.

Now we've got a single place where checks for those classes are
happening and other areas are simply checking for variables set by
those check macros, keeping CMake output clean and nice.
2016-01-14 12:38:46 +05:00
Sergey Sharybin
2af7637f20 Cycles: Add option to directly link against CUDA libraries
The main purpose of such linking is to make Blender compatible with
NVidia's debuggers and profilers which are doing some LD_PRELOAD
magic to intercept some function calls. Such magic conflicts with
our CUDA wrangler magic and causes segmentation faults.

The option is disabled by default, so there's no affect on any of
artists.

In order to make Blender linked directly against CUDA library use
the WITH_CUDA_DYNLOAD CMake option (it's marked as advanced).
2016-01-14 12:27:22 +05:00
Sergey Sharybin
7142bf6cf3 Cycles: Use proper primitive for the motion subsurface refine 2016-01-12 17:09:29 +05:00
Sergey Sharybin
ac7aefd7c2 Cycles: Use special debug panel to fine-tune debug flags
This panel is only visible when debug_value is set to 256 and has no
affect in other cases. However, if debug value is not set to this
value, environment variables will be used to control which features
are enabled, so there's no visible changes to anyone in fact.

There are some changes needed to prevent devices re-enumeration on
every Cycles session create.

Reviewers: juicyfruit, lukasstockner97, dingto, brecht

Reviewed By: lukasstockner97, dingto

Differential Revision: https://developer.blender.org/D1720
2016-01-12 16:21:30 +05:00
Sergey Sharybin
72e31d6a72 Cycles: Always inline triangle precalc for CUDA devices
Since the SSS changes compiling Experimental sm_52 kernel seems
to work just fine.
2016-01-11 21:41:00 +05:00
Sergey Sharybin
a60c3c6b21 Cycles: Fix for SSS objects being black when combined with motion blur 2016-01-11 21:39:24 +05:00
Thomas Dinges
d23f478863 Cycles: Add utility funcs to UI code, to check GPU usage.
Can be useful sometimes, and we already have this for CPU. Required for
some further work here.
2016-01-10 21:52:39 +01:00
Lukas Stockner
d330162ba6 Cycles: Fix Uninitialized Value compiler warning in the scoped_timer
Although the code made it impossible to use time_start_ uninitialized, at least GCC did
still produce multiple warnings about it.
Since time_dt() is an extremely cheap operation and functionality does not change in any way when
removing the check in the constructor, this commit removes the check and therefore the warning.
2016-01-10 00:50:54 +01:00
Lukas Stockner
64df7a2b38 Cycles: Read Wave texture profile in the XML parser 2016-01-10 00:24:12 +01:00
Lukas Stockner
6995b4d8d9 Cycles: Adding Hilbert Spiral as a tile order for rendering
This patch adds the "Hilbert Spiral", a custom-designed continuous space-filling curve, as a tile order for rendering in Cycles.
It essentially works by dividing the tiles into tile blocks which are processed in a spiral outwards from the center. Inside each
block, the tiles are processed in a regular Hilbert curve pattern. By rotating that pattern according to the spiral direction,
a continuous curve is obtained, which helps with cache coherency and therefore rendering speed.

The curve is a compromise between the faster-rendering Bottom-to-Top etc. orders and the Center order, which is a bit slower,
but starts with the more important areas. The Hilbert Spiral also starts in the center (unless huge tiles are used) and is still
marginally slower than Bottom-to-Top, but noticeably faster than Center.

Reviewers: sergey, #cycles, dingto

Reviewed By: #cycles, dingto

Subscribers: iscream, gregzaal, sergey, mib2berlin

Differential Revision: https://developer.blender.org/D1166
2016-01-10 00:13:53 +01:00
Campbell Barton
0ded953eea Cleanup: warning/spelling 2016-01-09 22:56:43 +11:00
Kévin Dietrich
14de8361f9 Smoke (fire): Move spectrum code from C++ (intern/) to C code (BLI)
This change is for a few reasons:
- it works with color, and (therefore) will need to be color managed, at
some point. This will be much easier to do if the code is closer to the
actual color management code (in Blender's core, so to speak).
- it has nothing to do with the actual fire simulation, as it is just
used to create a lookup table
- it can be reused for other purposes (i.e. in Blender internal
renderer, if people are interrested in a blackbody node à la Cycles)
- cleanup: some functions (`contrain_rgb`, `xyz_to_rgb`) already exist
in BLI

Reviewers: brecht

Reviewed By: brecht

Subscribers: brecht

Differential Revision: https://developer.blender.org/D1719
2016-01-09 04:48:31 +01:00
Bastien Montagne
2835a151c8 CMake: Make OSL's .oso shaders building also dependent on OSL compiler!
Otherwise, you can update OSL and not get .oso files regenerated, which is a quite
funny way to crash Blender...
2016-01-08 19:41:04 +01:00
Sergey Sharybin
0634fd0e97 Remove raskter library
it's no longer used by any of the parts of Blender.
2016-01-08 16:30:30 +05:00
cd6c6ee1a5 Fix T46993: UI lag in fullscreen mode on OS X / Intel graphics.
If anyone finds OS X UI drawing glitches with different graphics cards please
report them and I'll add an exception specifically for Intel, but in theory this
should work fine for all graphics cards.
2016-01-07 23:51:38 +01:00
Bastien Montagne
261ac69f57 Fix RNA_enum_set_identifier(), needs a context to handle correctly dynamic enums. 2016-01-07 21:52:54 +01:00
Sergey Sharybin
5483695698 Cycles: Update some API to be ready for OSL 1.6
While previous code was already compiling with OSL 1.6 it was using some symbols
which were considered deprecated in upstream.

This commit adds some ifdefs, but soon we'll get rid of all them rather soon
with the upcoming OIIO/OSL update.
2016-01-07 14:04:12 +05:00
Sergey Sharybin
772a3dab21 Cycles: Update some types used form OSL
Some types were deprecated back in 2013, better to be prepared earlier for those
types being removed from upstream.
2016-01-07 13:15:30 +05:00
Sergey Sharybin
3d313c9e5c Cycles: Whitespace cleanup, extra space in the argument list
Seems we're really starting to need to have cpplint for Cycles.
2016-01-07 11:52:45 +05:00
Sergey Sharybin
02739bd051 Cycles: Cleanup, use "string_" prefix for functions in util_string
No functional changes, just makes it easier to track where the function
is coming from.
2016-01-07 11:47:58 +05:00
Sergey Sharybin
9f2d33a652 Cycles: Fix wrong transparency flag being set to integrator
Patch from be28706 made it so integrator will use last shader's transparent
shadow flag, which is wrong since last shader might not have transparent
shadow while shaders prior to it might have one.
2016-01-07 11:45:13 +05:00
Thomas Dinges
3da0af1464 Cycles: Add utility function to convert bool to string. 2016-01-07 01:38:25 +01:00
Thomas Dinges
db72639e1f Cleanup: Fix Cycles compile warning on MSVC. 2016-01-07 00:26:26 +01:00
Thomas Dinges
81a253a0d5 Cycles OpenCL: Change environment flags for testing.
CYCLES_OPENCL_TEST was removed, there was an insonsistency between
opencl_kernel_use_split() and opencl_get_usable_devices().

From now on, to test non whitelisted devices please use either
CYCLES_OPENCL_MEGA_KERNEL_TEST or CYCLES_OPENCL_SPLIT_KERNEL_TEST.
2016-01-07 00:14:04 +01:00
Thomas Dinges
83e73a2100 Cycles: Refactor how we pass bounce info to light path node.
This commit changes the way how we pass bounce information to the Light
Path node. Instead of manualy copying the bounces into ShaderData, we now
directly pass PathState. This reduces the arguments that we need to pass
around and also makes it easier to extend the feature.

This commit also exposes the Transmission Bounce Depth to the Light Path
node. It works similar to the Transparent Depth Output: Replace a
Transmission lightpath after X bounces with another shader, e.g a Diffuse
one. This can be used to avoid black surfaces, due to low amount of max
bounces.

Reviewed by Sergey and Brecht, thanks for some hlp with this.

I tested compilation and usage on CPU (SVM and OSL), CUDA, OpenCL Split
and Mega kernel. Hopefully this covers all devices. :)
2016-01-06 23:43:29 +01:00
Sergey Sharybin
ea7a2766f6 Cycles: Fix possible buffer overflow in OIIO cache error message 2016-01-06 23:09:48 +05:00
Sergey Sharybin
03302fd5ed Fix T47120: CPU OSL Cycles crashes blender in latest GIT
The issue was caused by leaking error messages caused by
getting OIIO texture handle for built-in images.
2016-01-06 23:06:54 +05:00
Sergey Sharybin
944b6322e6 Cycles: Log whch optimizations are used for CPU kernels
Not fully thread-safe, but is rather harmless. Just some messages
might be logged several times.
2016-01-06 20:25:19 +05:00
Sergey Sharybin
e2846c999a Cycles: Fix stupid mistake which was assining kernel function in a loop 2016-01-06 20:05:33 +05:00
Sergey Sharybin
5d564da3b6 Cycles: Fix memory leak in shader graph when bump graph is used 2016-01-05 21:18:02 +05:00
Martijn Berger
2d9ed6e7c8 fix compiling cycles after recent gflags / glog shuffle 2016-01-05 14:14:10 +01:00
Sergey Sharybin
4a3e89e9ee Fix wrong linking flags for Libmv tests 2016-01-04 23:32:57 +05:00
Sergey Sharybin
474aa8515d Libmv: Solve some strict compiler warnings 2016-01-04 19:48:15 +05:00
Sergey Sharybin
ba432299cd Move Libmv from extern/ to intern/
Logically it is intern library since being mainly developed by 1.5 blender guys.
2016-01-04 19:39:13 +05:00
Sergey Sharybin
0b856dd97e Move GLog/GFlags to extern/
This is where the libraries belongs to actually, they are not only used by
Libmv now, but also by tests and Cycles.
2016-01-04 19:39:13 +05:00
Sergey Sharybin
2cdd4a5467 Cycles: Fix access uninitialized SVM stack caused by recent optimization 2016-01-04 17:11:52 +05:00
Sergey Sharybin
5d99cde822 Remove SCons building system
While SCons building system was serving us really good for ages it's no longer
having much attention by the developers and started to become quite a difficult
task to maintain.

What's even worse -- there started to be quite serious divergence between SCons
and CMake which was only accumulating over the releases now. The fact that none
of the active developers are really using SCons and that our main studio is also
using CMake spotting bugs in the SCons builds became quite a difficult task and
we aren't always spotting them in time.

Meanwhile CMake became really mature building system which is available on every
platform we support and arguably it's also easier and more robust to use.

This commit includes:

- Removal of actual SCons building system
- Removal of SCons git submodule
- Removal of documentation which is stored in the sources and covers SCons
- Tweaks to the buildbot master to stop using SCons submodule
  (this change requires deploying to the server)
- Tweaks to the install dependencies script to skip installing or mentioning
  SCons building system
- Tweaks to various helper scripts to avoid mention of SCons folders/files
  as well

Reviewers: mont29, dingto, dfelinto, lukastoenne, lukasstockner97, brecht, Severin, merwin, aligorith, psy-fi, campbellbarton, juicyfruit

Reviewed By: campbellbarton, juicyfruit

Differential Revision: https://developer.blender.org/D1680
2016-01-04 14:20:48 +05:00
Sergey Sharybin
da49ee30b0 Fix T47100: OpenCL compilation warnings due to missing space in the argument list 2016-01-03 23:13:49 +05:00
Sergey Sharybin
a3df65dea8 Fix T47008: OSL Memory Corruption (Use after free)
The issue was caused by OSL using TLS which is required to be freed before the
Cycles session is freed. This is quite tricky to do in Cycles because different
render session are sharing the same task scheduler, so when one session is being
freed TLS might need to be active still.

In order to solve this, we are now doing JIT optimization ahead of the time
which ensures either TLS of JIT is freed before the render on multi-core system
or freed on OSLRenderSession destroy on single-core system.

This might increase synchronization time due to JIT of unused function, but
that we can solve later with some smart idea,
2016-01-03 18:28:33 +05:00
Lukas Stockner
b1a7fc2c51 Cycles: Force bottom-to-top tile order for viewport rendering
This commit overrides the user's choice of tile order in the case of viewport rendering and always uses bottom-to-top instead.
This was already done until the TileManager redesign, but since it removed the distinction between viewport and regular rendering
in the manager, the viewport was now also using the selected order. Since this requires sorting of the generated tiles,
it slows down rendering a bit. With the forced bottom-to-top order, this sorting step can now be avoided again.

Since the tile order is invisible anyways for viewport rendering, this commit won't have any impact on users (apart from a slight speedup).
2016-01-02 01:15:26 +01:00
Lukas Stockner
5c682a901b Cycles: Add Saw option to the wave texture
This commit adds "Bands Saw" and "Rings Saw" to the options for the Wave texture node in Cycles, behaving similar to the Saw option in BI textures.
Requested by @cekuhnen on BA.

Reviewers: dingto, sergey

Subscribers: cekuhnen

Differential Revision: https://developer.blender.org/D1699
2016-01-01 23:25:37 +01:00
Thomas Dinges
1ed610ed73 Fix OSL compilation, cannot assign vector to color. 2016-01-01 18:05:34 +01:00
Sergey Sharybin
ade35bac93 Cycles: Implement rolling shutter effect
This is an attempt to emulate real CMOS cameras which reads sensor by scanlines
and hence different scanlines are sampled at a different moment in time, which
causes so called rolling shutter effect. This effect will, for example, make
vertical straight lines being curved when doing horizontal camera pan.

This is controlled by the Shutter Type option in the Motion Blur panel.

Additionally, since scanline sampling is not instantaneous it's possible to have
motion blur on top of rolling shutter.

This is controlled by the Rolling Shutter Time slider which controls balance
between pure rolling shutter effect and pure motion blur effect.

Reviewers: brecht, juicyfruit, dingto, keir

Differential Revision: https://developer.blender.org/D1624
2015-12-31 20:44:27 +05:00
Sergey Sharybin
c81e6ffdf9 Fix T46915: Non-intuitive behavior of Vector Curve Mapping node
Vector mapping node was doing some weird mapping of both original and mapped
coordinates. Mapping of original coordinates was caused by the clamping nature
of the LUT generated from the node. Mapping of the mapped value again was quite
totally obscure -- one needed to constantly keep in mind that actual value will
be scaled up and moved down.

This commit makes it so values in the vector curve mapping are always absolute.
In fact, it is now behaving quite the same as RGB curve mapping node and the
code could be de-duplicated. Keeping the code duplicated for a bit so it's more
clear what exact parts of the node changed.

Reviewers: brecht

Subscribers: bassamk

Differential Revision: https://developer.blender.org/D1672
2015-12-31 20:40:22 +05:00
Sergey Sharybin
99da8e1ed8 Cycles: Fix viewport rendering with multiple GPU devices 2015-12-31 17:49:25 +05:00
Sergey Sharybin
0b4abd08b3 Cycles: Experiment with use of runtime tag instead of set for SVM generation
This gives about 2x speedup (3.2sec vs. 11.9sec with 32716 handled nodes) when
updating shader for the shader tree.

Reviewers: brecht, juicyfruit, dingto, lukasstockner97

Differential Revision: https://developer.blender.org/D1700
2015-12-31 15:58:18 +05:00
cf2005d942 Fix T47081: laplacian smooth edit mode tool crash. 2015-12-30 17:26:51 +01:00
Sergey Sharybin
f5c978074c Cycles: Code cleanup: use scoped timer to measure parts of SVM compiler 2015-12-30 19:35:21 +05:00
Sergey Sharybin
4d2eb42cfd Cycles: Wrap SVM compiler state variables into a single struct
This way it's easier to pass stuff around and also much easier to add more
state variables.

So far should be no functional changes for artists.
2015-12-30 19:21:19 +05:00
Sergey Sharybin
3918c8b9a5 Cycles: Optionally output luminance from the shader evaluation kernel
This makes it possible to move some parts of evaluation from host to the device
and hopefully reduce memory usage by avoid having full RGBA buffer on the host.

Reviewers: juicyfruit, lukasstockner97, brecht

Reviewed By: lukasstockner97, brecht

Differential Revision: https://developer.blender.org/D1702
2015-12-30 19:04:04 +05:00
Sergey Sharybin
c8a551bf13 Cycles: Don't install CPU-related kernel files 2015-12-30 18:51:35 +05:00
Sergey Sharybin
2b5d60eb2d Cycles: Deduplicte CPU kernel declaration and definition code
Main goal is to make kernel signatures editing easier and less prone to the
errors caused by missing function signature update or so.

This will also make it easier to add new CPU architectures.

Reviewers: juicyfruit, dingto, lukasstockner97, brecht

Reviewed By: dingto, lukasstockner97, brecht

Differential Revision: https://developer.blender.org/D1703
2015-12-30 17:54:02 +05:00
Thomas Szepe
2583cc88de Fix Moto overflow warnings
This fault (level 2, C4056) was introduced by changing Moto from double to float.
2015-12-30 12:45:36 +01:00
Martijn Berger
939dd2e168 Skip some more workarounds when using MSVC 2015 2015-12-30 11:23:10 +01:00
Sergey Sharybin
a6b67ca802 Cycles: Add timing information to the SVM compiler stats 2015-12-29 21:20:10 +05:00
Sergey Sharybin
aff9fd60bc Cycles: Optimize nodes deduplication routines
The idea is to have separate sets per node name in order to speed up the
comparison process. This will use a bit more memory and slow down simple
shaders, but this extra memory is not so much huge and time penalty is
not really measurable (at least from initial tests).

This saves orders of magnitude seconds when de-duplicating 17K nodes and
overall process now takes 0.01sec on my laptop,
2015-12-29 20:27:00 +05:00
Sergey Sharybin
3482cdb136 Cycles: Remove assert which is no longer valid
Was a left-over since 5b33115.
2015-12-29 19:19:53 +05:00
d1a26437ef OS X: remove code for OS X <= 10.5, which is already not supported since 2 years. 2015-12-29 00:27:18 +01:00
Sergey Sharybin
1a246afe03 Cycles: Use different approach for SVM summary report
Use Summary structure to collect all summary related on the shader compilation
process which then could be either simply reported to the log or be passed to
some user interface or so.

This is type of the summary / report which is most flexible and useful and
something we could use for other parts like shader optimization.
2015-12-28 19:42:37 +05:00
Sergey Sharybin
0ae2ade17a Cycles; Fix typo in the comment 2015-12-28 19:01:26 +05:00
Sergey Sharybin
18ccc6f960 Cycles: Log basic statistics of SVM compilation process 2015-12-28 19:01:07 +05:00
Sergey Sharybin
738f6d8127 Cycles: Implement node deduplication routines
The idea of this commit is to merge nodes which has identical settings
and matching inputs into a single node in order to minimize number of
SVM instructions.

This is quite simple bottom-top graph traversal and the trickiest part
is how to compare node settings without too much trouble which seems to
be solved is quite clean way.

Still possibilities for further improvements:

- Support comparison of BSDF nodes
- Support comparison of volume nodes
- Support comparison of curve mapping/ramp nodes

Reviewers: brecht, juicyfruit, dingto

Differential Revision: https://developer.blender.org/D1673
2015-12-28 16:37:48 +05:00
Campbell Barton
225b02fcd6 Fix for building ghost-tests 2015-12-28 21:40:49 +11:00
Kévin Dietrich
7ef10decdb Fix for heap-use-after-free happening in GHOST_EventManager.
Issue was that dispatchEvent might call removeWindowEvents/
removeTypeEvents which will delete the event before we can do so.

To address this, handled events are now put in a separate list.

Reported by psy-fi and reviewed by brecht in IRC.
2015-12-28 00:35:47 +01:00
Kévin Dietrich
c4c3d84d58 Addendum to previous GHOST commit: remove redundant check. 2015-12-27 21:32:19 +01:00
Kévin Dietrich
3e35e32e9d Fix memory leak in GHOST Event Manager.
The events are allocated on the heap, then pushed on a stack. Before
being processed, they are popped from the stack, and deleted after
processing is done. When the manager is destroyed (e.g. application
closing), any remaining event in the stack is detroyed.

Issue is that when the "application closing" event is processed, it is
never freed, because the manager gets destroyed before the call to
`delete` is made and the event is not on the stack anymore.

Now events are left on the stack while they are processed, and only
popped and deleted after processing is done.

As a slight bonus refactor: use void as return type for dispatch events
functions, as no caller is checking the return value, and it is not
clear what it means (suggested by the reviewer).

Reviewers: brecht

Differential Revision: https://developer.blender.org/D1695
2015-12-27 18:08:44 +01:00
Jörg Müller
fcc68a02e9 Fix T47064: Change Audio defaults to 48 kHz
Historically blender had an audio sample rate of 44.1 kHz as default which is mostly popular because it's the sample rate of audio CDs. Audaspace kept using this default from the pre 2.5 era. It was about time to change to 48 kHz, which is a more widespread standard nowadays, especially in video. It is the recommended sampling rate of the Audio Engineering Society.

Further reading: https://en.wikipedia.org/wiki/44,100_Hz#Status
2015-12-27 16:33:54 +01:00
Thomas Dinges
83addc0a1d Cleanup: SubsurfaceScatteringNode is a subclass of BsdfNode, no need to set the value again. 2015-12-25 11:58:52 +01:00
Lukas Stockner
8e07b87866 Cycles: Fix Tile access in the TileManager for viewport rendering
- When rendering in the Viewport, next_tile is sometimes called after a reset has been performed, but before
  new tiles were generated. In that case, the tile list would be invalid, causing Blender to crash randomly.
- When generating new tiles, the TileManager would not clear the tile lists before re-generating them, leading
  to some tiles being skipped during viewport rendering.
- When popping the next tile from a tile list, a reference to the just-deleted object would be returned, now the
  object is copied before deleting it.
2015-12-24 01:42:59 +01:00
Thomas Dinges
059b7a81e2 Cycles: Implement constant fold for the ConvertNode.
This way socket type conversions (such as color to float, or float to vector) do not stop the folding process.
Example: http://www.pasteall.org/pic/show.php?id=96803 (selected nodes are folded).
2015-12-23 21:48:19 +01:00
Lukas Stockner
548eb9eb4b Cycles: Sort tiles in rendering order at construction time
This commit modifies the TileManager to sort render tiles once after tiling the image,
instead of searching the next tile every time a new tile is acquired by a device.

This makes acquiring a tile run in constant time, therefore the render time is linear
w.r.t. the amount of tiles, instead of the quadratic dependency before.

Furthermore, each (logical) device now has its own Tile list, which makes acquiring
a tile for a specific device easier.
Also, some code in the TileManager was deduplicated.

Reviewers: dingto, sergey

Differential Revision: https://developer.blender.org/D1684
2015-12-23 13:14:36 +01:00
Thomas Dinges
887829e3d8 Cleanup: Remove comments, now that we have the dedicated constant fold functions, it's obvious. 2015-12-22 14:02:57 +01:00
Thomas Dinges
377b52be2e Cycles: Constant fold for the Gamma Node. 2015-12-22 13:53:13 +01:00
Campbell Barton
32be51dc66 Cleanup: warnings (msvc)
Part of patch D1670 by @LazyDodo
2015-12-21 13:02:38 +11:00
Sergey Sharybin
82921ce420 OpenSubdiv: Avoid having bad-level call
This is always asking for problems. Additionally, that call was leading
to OpenGL calls happening from threads.
2015-12-18 23:16:52 +05:00
Sergey Sharybin
672f2efbe6 Cycles: Log OSL texture system statistics after finishing the render 2015-12-18 21:50:30 +05:00
Sergey Sharybin
349affe370 Cycles: Implement proper texture derivatives evaluation for OSL
This was an oldie TODO since initial work on newer OSL/OIIO support.
Now we should be ready for the libraries bump.
2015-12-18 21:50:30 +05:00
Jorge Bernal
ee59df521f BGE clean up: use float version of trigonometric functions 2015-12-16 01:53:48 +01:00
Sergey Sharybin
5b33115070 Cycles: Fix wrong assert failure happening after recent de-duplicate
This is actually intended behavior to return NULL when the socket is not
found. It's used in certain BSDF nodes to query whether some inputs exists
or not.

Perhaps we can be more explicit here and have dedicated logic to query
socket existance and keep assert in place.

In any case, even if we lost assert() for the constant fold now it's
still somewhat better than duplicated code. Perhaps.
2015-12-15 21:01:56 +05:00
Sergey Sharybin
baaf10cb26 Cycles: De-duplicate utility functions in ccl::Graph 2015-12-15 20:04:35 +05:00
Ines Almeida
46218dc9f9 Fix: unreported crash with misconfigured nvidia opengl drivers 2015-12-13 10:36:52 +00:00
Jorge Bernal
0dcca69589 Moto Clean-up: double-promotion warnings 2015-12-13 02:56:30 +01:00
Porteries Tristan
6329e20cbb BGE: Use float as default instead of double in Moto library.
Use float in moto instead of double for MT_Scalar.
This switch allow future optimization like SSE.
Additionally, it changes the OpenGL calls to float versions as they are
very bad with doubles.

Reviewers: campbellbarton, moguri, lordloki

Reviewed By: lordloki

Subscribers: brecht, lordloki

Differential Revision: https://developer.blender.org/D1610
2015-12-13 02:09:05 +01:00
37c6a207ce Memutil: remove some unused code. 2015-12-11 01:48:26 +01:00
c7122b5391 IK Solver: remove unused and outdated test code. 2015-12-11 01:42:41 +01:00
8a66d4966a Moto: remove some unused code. 2015-12-11 01:40:56 +01:00
6e4802d712 IK Solver: replace TNT math library with Eigen.
Performance is about the same or slightly better for typical IK chains.
In extreme cases with many bones and multiple targets, of which some are
unreachable, I've seen 2x speedups.
2015-12-11 00:59:00 +01:00
aaa627d5f5 IK solver: replace Moto math library with Eigen. 2015-12-11 00:59:00 +01:00
Campbell Barton
5f0cf67882 Cleanup: quiet warning 2015-12-10 21:18:50 +11:00
f9047c3f8c Eigen: fold remaining OpenNL code into intern/eigen.
Differential Revision: https://developer.blender.org/D1662
2015-12-10 01:58:10 +01:00
858b680a50 Eigen: move C API into intern/eigen. 2015-12-10 01:58:06 +01:00
Sergey Sharybin
19dba67d15 Cycles: Comment out unused arguments 2015-12-09 18:38:02 +05:00
Mike Erwin
d7851b87a7 remove a debug printf 2015-12-08 20:13:45 -05:00
Mike Erwin
6006173f4a OpenGL: use sized texture internal formats
Maybe this is pedantic but I read it’s best to explicitly set the
desired component size.

Also append “_ARB” to float texture formats since those need an
extension in GL 2.1.
2015-12-08 01:19:55 -05:00
Martijn Berger
de0672436b Add support for compiling the cuda kernel on the Nvidia Jetson TX1 2015-12-07 17:51:24 +01:00
Mike Erwin
a048d5f945 OpenSubdiv: refine OpenGL version & extension checks
Use new GPU_legacy_support() function.

Determine GLSL version once instead of per shader.

For Texture Buffers, allow ARB or EXT version of the extension. Either
one will do.
2015-12-06 18:47:58 -05:00
Mike Erwin
1858823d3b OpenGL: request version 2.1 when creating context on Windows
In practice this gives us a context that is *compatible* with GL 2.1. On
my machine it gives a GL 3.3 or 4.3 compatibility profile context,
depending on graphics card installed.

Also fixed enum for core profile (not used yet).

Also added option for GL 3.2 compatibility profile. This will be useful
during Blender 2.8 development, until we are able to use the core
profile. On my machine this gives exactly a GL 3.2 compatibility profile
context, not 3.3 or 4.
2015-12-06 18:02:07 -05:00
Mike Erwin
ffabd037bb OpenSubdiv: disable TF on lower GL versions. Fixes T46794
My previous edit to this check was too lax.

OSD's shader for the Transform Feedback evaluator declares itself
#version 410 so disable the feature if user's GL < 4.1.
2015-12-06 18:02:06 -05:00
Thomas Dinges
a3d774e4c9 Cycles: Fold Value and RGB node as well.
This way, connecting Value or RGB node to e.g. a Math node will still allow folding.

Note: The same should be done for the ConvertNode, but I leave that for another day.
2015-12-06 23:47:38 +01:00
Sergey Sharybin
ed5dbb0a7b Cycles: Implement extrapolation for RGB curves
Previously RGB Curves node will clamp input to 0..1 which is rather useless
when one wants to use HDR image textures and do bit of correction on them.

Now kernel code supports extrapolation of baked LUT based on first/last two
table points and performs linear extrapolation.

The only tricky part is to guess the range to bake the LUT for. Currently
it's using simple approach -- minmax of the input curves. While this behaves
ok for the simple cases it's easy to trick the system up causing incorrect
results.

Not sure we can solve those issues in a general case and since the new code
is giving more expected results it's not that bad actually. In the worst
case artist migh always create explicit point to make sure LUT is created
for the needed HDR range.

Reviewers: brecht, juicyfruit

Subscribers: sebastian_k

Differential Revision: https://developer.blender.org/D1658
2015-12-06 01:21:14 +05:00
Bastien Montagne
76d1201996 Fix OSL shaders building with some versions of that lib.
This must have happened months ago, but as I did not `make clean` any build folder since then,
so only noted that today.

Issue is same as dirty patch we have to apply to ODL sources before building it in install_deps.sh - for
some mysterious reason, it has become impossible to compoile .osl files into .oso ones without
giving explicit output file name (otherwise it just produces `.oso` file - utterly stupid and useless).

We could probably fix that in own OSL source, but think being explicit here does not hurt anyway, so...
Let's go the easy way.
2015-12-05 00:17:04 +01:00
Sergey Sharybin
6552d5bebd Cycles: Avoid recursion when doing constant fold
This reduces stress on the the stack memory which could be really handy
on certain operation systems which applies strict limits on the stack.

Reviewers: brecht, juicyfruit, dingto

Reviewed By: brecht, juicyfruit, dingto

Differential Revision: https://developer.blender.org/D1656
2015-12-02 16:19:39 +05:00
Sergey Sharybin
d0a9ec5efc Cycles: Fix SSS object not properly reflected in glossy object with indirect clamping
This fixes remained issues reported in T46908.
2015-12-02 16:00:01 +05:00
Jörg Müller
3cd36f85b0 Fix T46815: Changing playback setting makes blender crash
Copied the fix from upstream audaspace.
2015-12-02 10:23:07 +01:00
Campbell Barton
fc9505c9c5 Cleanup: warnings & spelling 2015-12-02 13:15:52 +11:00
Sergey Sharybin
a6bbf05ba6 Cycles: Fix wrong SSS intersection refinement when this option is disabled
The code is disabled by default, but we'd better keep it all correct.
2015-12-02 03:14:54 +05:00
Sergey Sharybin
e82876589f Cycles: Fix wrong SSS on scaled instanced objects
Was a mistake on searching refined position form ray and hit distance.

Remember kids: SSS distance is in the object space!
2015-12-02 03:13:19 +05:00
Sergey Sharybin
70502578b1 Cycles: Remove TODO, it is possible there'll be more intersections recorded
It's just only few of them will be stored in the intersection array, nothing
wrong with that what's so ever.
2015-12-02 02:39:57 +05:00
Thomas Dinges
e5e1010919 Cleanup: Remove some more code for BVH cache. I missed that somehow. 2015-12-01 18:17:28 +01:00
Lukas Stockner
8512e284a0 Fix T46906: Cycles syntax error while compiling OpenCL kernels
The safe normalization was using a float as a condition, now the intended non-zero test is explicit.
2015-12-01 13:53:29 +01:00
Sergey Sharybin
607150d058 Fix T46898: OpenCL Fails to compile after recent SSS changes 2015-12-01 13:55:40 +05:00
Campbell Barton
5bfc32bab4 Cleanup: warning w/ unknown define 2015-11-30 11:03:49 +11:00
Sergey Sharybin
2ae7593700 Cycles: Avoid having two consequence getenv() calls 2015-11-28 21:05:12 +05:00
Sergey Sharybin
6147c4037d Cycles: Fix wrong volume stack after SSS bounce
Was introduced by a recent fixes, now it should be all correct and additionally
it solves the TODO mentioned in the code.
2015-11-28 20:07:34 +05:00
Sergey Sharybin
f5d1551b6e Cycles: Fix wrong original ray used for SSS baking
Also de-duplicated some code by moving to an utility function.
2015-11-28 20:07:34 +05:00