Commit Graph

4688 Commits

Author SHA1 Message Date
Sergey Sharybin
a922be9270 Cycles: Repot CPU and CUDA capabilities to system info operator
For CPU it gives available instructions set (SSE, AVX and so).

For GPU CUDA it reports most of the attribute values returned by
cuDeviceGetAttribute(). Ideally we need to only use set of those
which are driver-specific (so we don't clutter system info with
values which we can get from GPU specifications and be sure they
stay the same because driver can't affect on them).
2015-01-06 14:13:21 +05:00
Jens Verwiebe
e5063b0bd3 Cleanup: OSX: remove obsolete ppc/ppc64 sw-renderer kCGL attributes 2015-01-04 20:42:16 +01:00
Sergey Sharybin
1369bd562c Cycles: Fix compilation error on AVX platforms with -arch-native
Was a conflict in headers between clew and util_optimization.h.
2015-01-03 00:11:28 +05:00
Sergey Sharybin
2a8a56929b Cycles: Fix unneeded int/float conversion happened in previous commit 2015-01-02 17:21:24 +05:00
Sergey Sharybin
4f2583ee13 Fix T43027: OpenCL kernel compilation broken after QBVH
OpenCL apparently does not support templates, so the idea of generic
function for swapping is a bit of a failure. Now it is either inlined
into the code (in triangle intersection) or has specific implementation
for QBVH.

This is probably even better, because we can't create QBVH-specific
function in util_math anyway.
2015-01-02 14:58:01 +05:00
Campbell Barton
4abe548527 cleanup: style 2015-01-02 19:29:00 +11:00
Sergey Sharybin
e9596e5def Cycles: Post-reintegration tweaks to ensure things do compile
This commit contains all the tweaks which were missing in initial patch
re-integration from the standalone Cycles repository.

This commit also contains an utility cmake macro to help linking targets
with different libraries for release/debug builds, the name currently is

  target_link_libraries_decoupled

it gets a target and list of libraries and makes sure debug builds are
using libraries with "_d" suffix.

After all this changes it'll hopefully be easier to interchange patches
between blender and standalone repositories, because they're now quite
identical.
2015-01-01 01:31:08 +05:00
Sergey Sharybin
b8fc4fe5aa Cycles: Correction to previous SSE/AVX flags detection
Ensure AVX/AVX2 is not used when Cycles is configured with
WITH_CPU_SSE set to OFF.
2015-01-01 01:31:08 +05:00
Sergey Sharybin
93ca68b50c Cycles: Be ready for gflags namespace auto-detect
This way it is now possible to use gflags >= 2.1, where all the
functions were moved from google to gflags namespace.

This isn't currently used in blender, but for standalone repository
this change is essential.
2015-01-01 01:31:08 +05:00
Sergey Sharybin
405c0fddb4 CMake: Rework linking strategy a bit
Made it a dedicated macro to link release/debug targets against lib/lib_d
libraries which helps keeping code a bit more clean.

Also made it so MSVC is now happy about building debug Cycles with OSL
support.

Reshuffled code a bit and put some comments about what's going on, which
should make it a bit more clear.
2015-01-01 01:31:08 +05:00
Sergey Sharybin
2382c8decd Cycles: Fix compilation error with compilers which doesn't support AVX
For SSE checks still could be decoupled to be able to compile SSE2
kernel and not SSE4 depending on the CPU or so.
2015-01-01 01:31:08 +05:00
Sergey Sharybin
3b6b32d6a3 Cycles FTBFS: Send Boost after OIIO to the linker since the order matters 2015-01-01 01:31:08 +05:00
Sergey Sharybin
9b8942ac71 Cycles Standalone: Add initial support for compilation on Windows
This applies to an application comiling from the standalone Cycles repository
only.

There's still lack of proper install target, so currently pthreads
library is to be copied next to cycles.exe manually.
2015-01-01 01:31:08 +05:00
Sergey Sharybin
9e2e408323 Cycles: Add logging to OSL and CUDA initialization/compilation
This is what was handy troubleshooting issues in the studio,
plus this is exactly the same thing which would be helpful
when solving issues with paths to compiled shaders and cubins
for standalone repository.
2015-01-01 01:31:08 +05:00
Sergey Sharybin
bbf12722ed Cycles: Fully support WITH_CYCLES_LOGGING option
This commit generalizes logging module a little bit in making it possible to use
Glog logging in standalone Cycles repository.
2015-01-01 01:31:07 +05:00
Sergey Sharybin
f2665d52e2 CMake: Minor cleanup 2015-01-01 01:31:07 +05:00
Sergey Sharybin
e0a809fb1d Cycles: Fix compilation error when OIIO is compiled with external PugiXML parser
Basic idea is to check whether OIIO is compiled with embedded PugiXML parser
and if so use PugiXML from OIIO, otherwise find a standalone PugiXML library.
2015-01-01 01:31:07 +05:00
Campbell Barton
a4c3ca8671 CMake: use pthreads on all os's 2015-01-01 01:31:07 +05:00
Sergey Sharybin
b6c175b27a Cycles: Solve linking error caused by missing pthreads library
Not sure why it worked on Debian but didn't work on Arch, could have
been some indirect link dependency or so.

Anyway, we explicitly depends on pthreads, so need to do corresponding
find_package().
2015-01-01 01:31:07 +05:00
Sergey Sharybin
4497b6ac84 Cycles: Synchronize changes with standalone repository
This changes were done in original commit of the standalone Cycles repository
and needed here for easier patch synchronization.
2015-01-01 01:31:07 +05:00
Sergey Sharybin
caa2306d16 Libmv: Update to latest upstream version
Main purpose of this is to bring new gflags library which is more likely
to have a fix for undefined order of static variables initialization and
also to bring new glog where some compilation error are fixed (which are
only visible with more strict checks with clang and c++11 enabled).
2014-12-31 16:02:04 +05:00
Sergey Sharybin
7778f0ff20 Cycles: Fix MSVC which desn't like condition to be split by preprocessor 2014-12-29 21:10:37 +05:00
Sergey Sharybin
c5927cd977 Revert "Fix T42888: Separate and Combine HSV distorts the hue value"
This reverts commit 1549fea9995c348bc14a9105df5e460644e2b33a.

After some further discussion with other developers in the team it becomes
clear there's no correct solution here. It is just more matter of what's
more convenient in particular case.

We're just going back to old code to avoid possible frustration with the
older files in newer blenders. This also means all HSV/HSL is considered
to be "linear" in the shading nodes.

Would be ported to 2.73 final.
2014-12-29 18:14:08 +05:00
Sergey Sharybin
4088fad6dd Cycles: Add asserts around BVH stack pushes
This way we're kind of safer to troubleshoot possible stack overflow issues.
2014-12-29 14:02:15 +05:00
Sergey Sharybin
40517283ca Cycles: Bump stack size for QBVH traversal code
Traversal now can push up to 2x of nodes to the stack, so need some tweaks
to the stack size.
2014-12-29 13:37:18 +05:00
Sergey Sharybin
9c4aba11c9 Cycles: Add some sanity check asserts in the traversal code
This way we'll be sure (in debug builds) that regular BVH traversal is not used
for QBVH tree (could happen because of mismatch of logic in kernel and render).
2014-12-29 13:35:31 +05:00
Sergey Sharybin
ba9453f46f Cycles: Disable QBVH on 32bit systems all together
The reason for this is that we don't sue SSE optimization for 32bit platforms
because of T36316.

Things to look into:

- Nail the root of the issue of that report
- Implement non-SSE traversal code for QBVH
2014-12-29 13:23:44 +05:00
Sergey Sharybin
b11a2f7075 Cycles: Mark visibility TODO as resolved 2014-12-27 23:38:29 +05:00
Sergey Sharybin
91bbaaa271 Cycles: Fix visibility check for instanced nodes
The issue is that only instance node contains proper visibility flags,
nodes from instanced BVH are not correct.
2014-12-27 23:33:50 +05:00
Sergey Sharybin
836ea4b70f Fix T43019: Child of objectes used by duplis are visible in Cycles
Seems the parent check didn't go deep enough and only checked single parent.
Now it checks the chain of parents which seems to be correct but requires
much more intense testing.
2014-12-26 13:36:45 +05:00
Sergey Sharybin
cd095aae13 Cycles: Distance optimization for QBVH
This commit implements heuristic which allows to skip nodes pushed to the stack
from intersection if distance to them is larger than the distance to the current
intersection.

This should solve speed regression which i didn't notice in the original QBVH
commit (which could have because i had WIP version of this patch applied in my
local branch).

From quick tests speed seems to be much closer to what is was with regular BVH.

There's still some possible code cleanup, but they'll need a bit of assembly
code check and now i want to make it so artists can happily use Cycles over the
holidays.
2014-12-25 22:40:02 +05:00
Jens Verwiebe
c1f54bcdcc OSX: revive GHOST_HACK_getFirstFile cause it breaks things on older OSX versions.
Dunno exactly why this was done earlier, but propose not to remove code not understood.
2014-12-25 15:12:56 +01:00
Thomas Dinges
5f3dc592c8 Revert QBVH switch, after discussion with Sergey. 2014-12-25 12:18:51 +01:00
Sergey Sharybin
9e57babd8d Cycles: Fix really bad bug with shadow rays on non-SSE CPUs
basically shadow rays were totally broken and most of the time did not record
any intersections, leading to really ad rendering artifacts.

This commit makes it so regardless of enabled optimization level render result
would be the same.
2014-12-25 14:30:05 +05:00
Sergey Sharybin
fe06ec82a9 Cycles: Workaround CUDA 6.5.16 error after watertight commit
This issue doesn't happen with 6.5.12 and there's slight piece of hope it'll be
fixed in next toolkit releases..

For now we're forcing CUDA to not inline ray precalculation. This could lead to
some speed regression, but wouldn't expect it to be huge -- this code does not
run that often comparing to actual triangle intersection.
2014-12-25 14:15:37 +05:00
Sergey Sharybin
010f3ee438 Cycles: Fix compilation error on non-SSE2 architectures 2014-12-25 14:11:37 +05:00
Thomas Dinges
ee36e75b85 Cleanup: Fix Cycles Apache header.
This was already mixed a bit, but the dot belongs there.
2014-12-25 02:50:24 +01:00
Thomas Dinges
4ab821c675 Cleanup: Typo fixes for comments. 2014-12-25 02:42:06 +01:00
Thomas Dinges
6e7c2d2e43 Cycles: Expose QBVH on/off switch to the UI.
We might remove this again in the future, but for testing purposes
during the release cycle, this will be useful.

The setting defaults to QBVH, and can be found in the Performance panel.
2014-12-25 02:19:14 +01:00
Sergey Sharybin
deb06c457d Cycles: Correction for node tail copy on packing BVH
This is harmless for now because tail of the node is zero in there, but better
to fix it early so in the case of extending BVH nodes this code doesn't give
issues.
2014-12-25 02:50:49 +05:00
Sergey Sharybin
0feba652f7 Cycles: Enable QBVH optimization structure for SSE2 CPUs
This commit enables QBVH optimization structure automatically if rendering
with CPU and SSE2 support is detected.

This brings render time of agent shot back to the speed it used to be before
the watertight intersections commit, single koro and sponza scenes are about
7% faster here.
2014-12-25 02:50:49 +05:00
Sergey Sharybin
03f28553ff Cycles: Implement QBVH tree traversal
This commit implements traversal for QBVH tree, which is based on the old loop
code for traversal itself and Embree for node intersection.

This commit also does some changes to the loop inspired by Embree:

- Visibility flags are only checked for primitives.

  Doing visibility check for every node cost quite reasonable amount of time
  and in most cases those checks are true-positive.

  Other idea here would be to do visibility checks for leaf nodes only, but
  this would need to be investigated further.

- For minimum hair width we extend all the nodes' bounding boxes.

  Again doing curve visibility check is quite costly for each of the nodes and
  those checks returns truth for most of the hierarchy anyway.

There are number of possible optimization still, but current state is good
enough in terms it makes rendering faster a little bit after recent watertight
commit.

Currently QBVH is only implemented for CPU with SSE2 support at least. All
other devices would need to be supported later (if that'd make sense from
performance point of view).

The code is enabled for compilation in kernel. but blender wouldn't use it
still.
2014-12-25 02:50:49 +05:00
Sergey Sharybin
788fb8321a Cycles: Store proper empty boundbox for missing child nodes in QBVH
The idea is to make sure those childs would never be intersected with a ray
in order to make it so kernel never worries about number of child nodes.
2014-12-25 02:50:49 +05:00
Sergey Sharybin
30b12b1b27 Cycles: Code cleanup, de-duplicate definition of FEATURE
Previously every BVH traversal file was defining macro to check which features
should be compiled in, now this macro is defined in the parent header.
2014-12-25 02:50:49 +05:00
Sergey Sharybin
0476e2c87a Cycles: Rework BVH functions calls a little bit
Basic idea is to allow multiple implementation per feature-set, meaning this
commit tries to make it easier to hook new algorithms for BVH traversal.
2014-12-25 02:50:49 +05:00
Sergey Sharybin
ab8d9c4b88 Cycles: Add some utility functions and structures
Most of them are not currently used but are essential for the further work.

- CPU kernels with SSE2 support will now have sse3b, sse3f and sse3i

- Added templatedversions of min4, max4 which are handy to use with register
  variables.

- Added util_swap function which gets arguments by pointers.
  So hopefully it'll be a portable version of std::swap.
2014-12-25 02:50:49 +05:00
Sergey Sharybin
f770bc4757 Cycles: Implement watertight ray/triangle intersection
Using this paper: Sven Woop, Watertight Ray/Triangle Intersection

  http://jcgt.org/published/0002/01/05/paper.pdf

This change is expected to address quite reasonable amount of reports from the
bug tracker, plus it might help reducing the noise in some scenes.

Unfortunately, it's currently about 7% slower than the previous solution with
pre-computed triangle plane equations, but maybe with some smart tweaks to the
code (tests reshuffle, using SIMD in a nice way or so) we can avoid the speed
regression.

But perhaps smartest thing to do here would be to change single triangle / ray
intersection with multiple triangles / ray intersections. That's how Embree does
this and it's watertight single ray intersection is not any faster that this.

Currently only triangle intersection is modified accordingly to the paper, in
the future we would also want to modify the node / ray intersection.

Reviewers: brecht, juicyfruit

Subscribers: dingto, ton

Differential Revision: https://developer.blender.org/D819
2014-12-25 02:50:49 +05:00
Sergey Sharybin
57d235d9f4 Cycles: Optimize storage of QBVH node by one float4
The idea is to store visibility flags for leaf nodes only since visibility check
for inner nodes costs too much for QBVH hence it is not optimal to perform.

Leaf QBVH nodes have plenty of space to store all sort of flags, so we can make
nodes one element smaller, saving noticeable amount of memory.
2014-12-25 02:50:49 +05:00
Sergey Sharybin
a888b8beaf Cycles; Code cleanup, make it more obvious what #endif belongs to 2014-12-25 02:50:49 +05:00
Sergey Sharybin
144096faad Cycles: Make it more clear offsets in BVH construction
Previously offsets were calculated based on the BVH node size,
which is wrong and real PITA in cases when some extra data is
to be added into (or removed from) the node.

Now use offsets which are not calculated form the node size.
2014-12-25 02:50:49 +05:00