Commit Graph

572 Commits

Author SHA1 Message Date
Antony Riakiotakis
016e75ad64 Fix T42139, vertical noise stripe patterns in noise texture.
Two fixes here (only the second one is strictly needed to fix the issue,
but both make the system better).

First is introduction of a random generator array for use with threaded
systems where each thread needs to access its own number generator.
The random texture now uses this so it should not be influenced by other
random generator reseedings of the main random generator like it did
before.

Second, I reshuffled the texture code to resample the upper bits of the
random number first. According to Numerical Recipes, this is where the
most variance can be found, so by sampling those we avoid correlation
issues. Also, multiplying here is not ideal because if a pair of bits
are zero, then the whole result will also be zero.

Overall this is much more random (tm) than before, however result will
also be brighter, since we now have less black spots. Tweaking the
brightness/contrast should somewhat fix that, generally having the same
result as before is not possible anyway if we are to really fix this.

Also, seems like exposing procedural depth might be nice here since it
influences the precision of the texture lookup.
2014-10-09 15:48:52 +02:00
Jason Wilkins
8d084e8c8f Ghost Context Refactor
https://developer.blender.org/D643
Separates graphics context creation from window code in Ghost so that they can vary separately.
2014-10-07 15:47:32 -05:00
Sergey Sharybin
a9521c428e Correction for wrong ifdef in creator 2014-10-06 14:54:58 +02:00
Campbell Barton
6bde5381bb Cleanup: indentation 2014-10-02 10:33:15 +02:00
Sergey Sharybin
13d8671a1a Cycles: Add support of Glog logging
This commit makes it possible to use Glog library for the debug logging.
For now only possible when using CMake and in order to use the logging
the WITH_CYCLES_LOGGING configuration variable is to be enabled.

When this option is not enabled or when using Scons there's no difference
in Cycles behavior at all, when using logging and no output to the console
impact is gonna to be minimal.

This is done in order to make it possible to have debug logging persistent
in code (without need to add it when troubleshooting some bug and removing
it afterwards).

For now actual logging is not placed yet, only all the functions needed for
the logging are written and so.
2014-09-25 17:08:32 +06:00
Campbell Barton
3c00efcf69 Warn when --engine arg isn't found 2014-09-09 01:44:41 +10:00
Martijn Berger
4776d80aaa Disable msvc runtime fma3 use in an attempt to fix msvc 2013 + windows 7 issues.
MS report:
https://connect.microsoft.com/VisualStudio/feedback/details/811093
2014-09-05 11:09:54 +02:00
Campbell Barton
a4d9c8f579 Code cleanup: casts, dead assignment & arg order. 2014-06-26 15:46:42 +10:00
Sergey Sharybin
cc0c94d535 Switch allocator to thread-safe when rendering from the command line
This is needed because render threads would do some allocations like
part buffer allocation and so. This is likely harmless with the lock
free allocator (not on Windows tho), but when using guarded allocator
we need to be sure access to the list of MemHead is safe.
2014-06-24 14:15:21 +06:00
Bastien Montagne
414c70435d T39690: Modifications to Blender's 'temp dir' system.
Current temporary data of Blender suffers one major issue - default 'temp' dir on Windows is never
automatically cleaned up, and can end being quite big when used by Blender, especially when we have
to store per-process data (using getpid() in file names).

To address this, this patch:
* Divides tempdir paths in two, one for 'base' temp dir (the same as previous unique tempdir path),
  the other is a mkdtemp-generated sub-dir, specific to each Blender instance.
* Only uses base tempdir when we need some shallow persistance accross Blender sessions - and we always
  reuse the same filename (quit.blend...) or generate small file (crash reports...).
* Uses temp sub-dir for heavy files like pointcache or renderEXRs (Save Buffer option).
* Erases temp sub-dir on quit or crash.

To get this working it also adds a working 'recursive delete' to BLI_delete() under Windows.

Note that, as in current code, the 'recover render result' hack-feature that was possible
with SaveBuffer option is still removed. A real renderresult cache feature will be added
soon, though.

Reviewers: campbellbarton, brecht, sergey

Reviewed By: campbellbarton, sergey

CC: sergey

Differential Revision: https://developer.blender.org/D531
2014-06-23 13:42:54 +02:00
Campbell Barton
4ca67869cc Code cleanup: remove unused includes
Opted to keep includes if they are used indirectly (even if removing is possible).
2014-05-01 04:47:51 +10:00
Bastien Montagne
35747ee3d5 Rename "BLI_cpu.h" to "BLI_system.h" and add to it BLI_getpid() helper.
There is not much sense to have a whole BLI file just to check SSE2 on CPUs...
So idea is to rename it to more generic "BLI_system", and add to it more system-related
utils, like e.g. an include helper for getpid(), which allows to hide unix/windows
internals from rest of the code...

Reviewers: campbellbarton

Reviewed By: campbellbarton

Differential Revision: https://developer.blender.org/D439
2014-04-02 11:59:43 +02:00
Campbell Barton
617557b08e Code cleanup: remove TRUE/FALSE & WITH_BOOL_COMPAT define 2014-04-01 15:22:28 +11:00
Campbell Barton
905c816834 Doxy comment for main() 2014-03-30 20:14:57 +11:00
Lukas Tönne
08444518e6 Removing ParticleSystem->frand arrays to avoid memory corruption issues
in threaded depgraph updates and effector list construction.

Gathering effectors during depgraph updates will call the
psys_check_enabled function. This in turn contained a DNA alloc call
for the psys->frand RNG arrays, which is really bad because data must be
immutable during these effector constructions.

To avoid such allocs the frand array is now global for all particle
systems. To avoid correlation of pseudo-random numbers the psys->seed
value is complemented with random offset and multiplier for the actual
float array. This is not ideal, but work sufficiently well (given that
random numbers were already really limited and show repetition quite
easily for particle counts > PSYS_FRAND_COUNT).
2014-03-07 11:20:45 +01:00
Campbell Barton
e3f4037075 Fix T38715: Setting object mode fails from command line
also run load pre/post callbacks
2014-02-19 14:04:35 +11:00
Campbell Barton
a397009181 Fix T38541: sys.exit fails when blender is built as a py-module 2014-02-13 06:58:06 +11:00
Campbell Barton
b3afbcab8f ListBase API: add utility api funcs for clearing and checking empty 2014-02-08 06:24:05 +11:00
Lawrence D'Oliveiro
959da7477d Fix missing $BLENDER_USER_DATAFILES in command line help text.
Reviewed By: brecht

Differential Revision: https://developer.blender.org/D249
2014-02-04 18:51:05 +01:00
Lawrence D'Oliveiro
17b6143244 Correct help: -b/--background does not take a file argument
The documentation for the -b/--background option incorrectly states that it
takes a <file>, however it can run also without a file with e.g. a script.

Reviewed By: brecht

Differential Revision: https://developer.blender.org/D250
2014-02-04 18:51:05 +01:00
Sergey Sharybin
5c750b76f2 Move depsgraph debug print under --debug-depsgraph command line argument 2014-01-29 17:48:07 +06:00
Lawrence D'Oliveiro
3b32507b41 Blender docs: Correct upper limit, shown for missing -t option value.
Differential Revision: https://developer.blender.org/D248
2014-01-25 12:29:37 +01:00
Sergey Sharybin
709041ed0b Threaded object update and EvaluationContext
Summary:
Made objects update happening from multiple threads. It is a task-based
scheduling system which uses current dependency graph for spawning new
tasks. This means threading happens on object level, but the system is
flexible enough for higher granularity.

Technical details:

- Uses task scheduler which was recently committed to trunk
  (that one which Brecht ported from Cycles).

- Added two utility functions to dependency graph:
  * DAG_threaded_update_begin, which is called to  initialize threaded
    objects update. It will also schedule root DAG node to the queue,
    hence starting evaluation process.

    Initialization will calculate how much parents are to be evaluation
    before current DAG node can be scheduled. This value is used by task
    threads for faster detecting which nodes might be scheduled.

  * DAG_threaded_update_handle_node_updated which is  called from task
    thread function when node was fully handled.

	This function decreases num_pending_parents of node children and
	schedules children with zero valency.

    As it might have become clear, task thread receives DAG nodes and
    decides which callback to call for it.

    Currently only BKE_object_handle_update is called for object nodes.

    In the future it'll call node->callback() from Ali's new DAG.

- This required adding some workarounds to the render pipeline.
  Mainly to stop using get_object_dm() from modifiers' apply callback.
  Such a call was only a workaround for dependency graph glitch when
  rendering scene with, say, boolean modifiers before displaying
  this scene.

  Such change moves workaround from one place to another, so overall
  hackentropy remains the same.

- Added paradigm of EvaluaitonContext. Currently it's more like just a
  more reliable replacement for G.is_rendering which fails in some
  circumstances.

  Future idea of this context is to also store all the local data needed
  for objects evaluation such as local time, Copy-on-Write data and so.

  There're two types of EvaluationContext:

  * Context used for viewport updated and owned by Main. In the future
    this context might be easily moved to Window or Screen to allo
    per-window/per-screen local time.

  * Context used by render engines to evaluate objects for render purposes.
    Render engine is an owner of this context.

  This context is passed to all object update routines.

Reviewers: brecht, campbellbarton

Reviewed By: brecht

CC: lukastoenne

Differential Revision: https://developer.blender.org/D94
2013-12-26 17:24:42 +06:00
Campbell Barton
2a2c27b175 Fix for crash when no args where given with -o, -x command line args
Patch D123 from djnz (Masakazu Ito)
2013-12-23 13:08:32 +11:00
522f17daa1 Fix T37713: proxy not updated for first frame in background render.
The problem is that the animation curves are first before object updates,
where BKE_pose_rebuild and proxy synchronize will undo the animation when the
proxy is evaluted for the first time after loading.

This is somewhat of a workaround but it's also useful to have the scene updated
once when opening in background mode, and it makes rendering from the UI and
background more similar and so more predictable to give the same result.
2013-12-10 19:54:42 +01:00
Antony Riakiotakis
7cdfe18385 Fix compile error on MinGW64, time.h is required for gmtime. 2013-11-20 23:47:05 +02:00
Campbell Barton
84c30edbdf fix for crash with new buildinfo, when gmtime() returns NULL 2013-11-18 02:41:28 +11:00
Sergey Sharybin
927dea436e Further tweaks to buildinfo
Summary:
Old idea with changes since previous release tag
didn't work good enough. In most of the cases tag
was done in a branch hence not actually reachable
from the master branch.

Now change since release is gone, and date of
the latest commit is used instead.

The date is displayed in format YYYY-MM-DD HH:mm
in the splash.

New bpy.app fields:

- build_commit_timestamp is an unix timestamp of
  the commit blender was build from.
- build_commit_date is a date of that commit.
- build_commit_time is a time of that commit.

Reviewers: campbellbarton

Differential Revision: http://developer.blender.org/D5
2013-11-15 18:05:27 +06:00
Sergey Sharybin
2010c6ad6c Made buildinfo aware of builds from GIT
- Use commit number since last annotated tag as a
  revision number replacement. It'll eb followed
  by 'M' symbol if there're local modification in
  the source tree.

- Commit short SHA1 is included. Helps getting
  information about commit used to build blender
  with much faster.

- If build is not done from master branch, this also
  will be noticed in the splash screen.

This commit also replaces revision stored in the
files with git-specific fields (change and hash).
This is kind of breaks compatibility, meaning
files which were saved before this change wouldn't
display any information about which revision they
were saved with. When we'll finally switch to git,
we'll see proper hash and change number since
previous release in the files, for until then
svn version will be used as a change number and
hash will be empty.

Not a huge deal, since this field was only used
by developers to help torubleshooting things and
isn't needed for blender itself.

Some additional tweaks are probably needed :)
2013-11-04 13:21:39 +00:00
Campbell Barton
f9d5bccb06 code cleanup: spelling 2013-10-31 23:52:44 +00:00
Sergey Sharybin
4bd4037276 Lock-free memory allocator
Release builds will now use lock-free allocator by
default without any internal locks happening.

MemHead is also reduces to as minimum as it's possible.
It still need to be size_t stored in a MemHead in order
to make us keep track on memory we're requesting from
the system, not memory which system is allocating. This
is probably also faster than using a malloc's usable
size function.

Lock-free guarded allocator will say you whether all
the blocks were freed, but wouldn't give you a list
of unfreed blocks list. To have such a list use a
--debug or --debug-memory command line arguments.

Debug builds does have the same behavior as release
builds. This is so tools like valgrind are not
screwed up by guarded allocator as they're currently
are.

--
svn merge -r59941:59942 -r60072:60073 -r60093:60094 \
          -r60095:60096 ^/branches/soc-2013-depsgraph_mt
2013-10-10 11:58:01 +00:00
Campbell Barton
f5eb880358 freeing mempool elements now fills freed memory with --debug for debug builds. 2013-10-03 14:44:33 +00:00
Campbell Barton
9e561a641e remove callback BLI_localErrorCallBack from scanfill, was here for years and only ever wrapped printf. 2013-08-28 02:14:24 +00:00
Campbell Barton
11aa7a76fa quiet warnings when building as a python module 2013-08-26 19:32:03 +00:00
Sergey Sharybin
beffaa293e Made modifiers_getVirtualModifierList safe for threading
Move static variables to context filling in by this fcuntion
and owned by a callee function. This ensures no conflicts
between threads happens because of static variables used in
this function.

Also moved modifier types and virtual modifiers data to a
function called from creator. This is needed to be sure all
the information is properly initialied to the time when
threads starts to use this data.

--
svn merge -r57899:57900 ^/branches/soc-2013-depsgraph_mt
2013-08-19 09:05:34 +00:00
Jason Wilkins
4dfe00c802 _MSV_VER should be _MSC_VER 2013-07-21 17:16:04 +00:00
Brecht Van Lommel
1c01ad53d5 Remove SDL_VIDEODRIVER=dummy environment variable setting, this may interfere
with other applications launching SDL applications from Blender.

At the time this was added the game engine joystick code was unnecessarily
initializing the SDL video subsystem, and looking at the SDL source code that's
the only place this environment variable is read. That doesn't happen anymore,
though we do have WITH_GHOST_SDL now. But the environment variable is set after
GHOST has been initialized, otherwise this code would have actually broken that.
2013-07-04 11:28:52 +00:00
Campbell Barton
32d5b52f59 re-arrange '--help' output into more useful sections (added debug, python).
also minor style cleanup
2013-06-29 10:09:15 +00:00
Campbell Barton
a050ddf279 remove unused callback 2013-06-26 03:42:45 +00:00
Campbell Barton
447e9a4cd5 add option to enable auto-execute scripts, but exclude certain directories. 2013-06-18 18:11:52 +00:00
Campbell Barton
412c043474 Python script auto-execution changes:
- script execution is off by default

- if a blend file attempts to execute a script
  this shows a message in the header with the action
  that was suppressed (script/driver/game-autostart) and 2 buttons to either reload the file trusted, or to ignore the message.

- the file selector will always default to use the trust setting in the user preferences,
  but reloading an open file will keep using the current setting (whatever was set before or set on the command-line).

- added SCons setting WITH_BF_PYTHON_SECURITY, this sets the default state for the user prefereces not to trust blend files on load.
  ... this option was in CMake before, but always off, now its enabled by default for SCons and CMake, and forced on in CMake for now.
2013-06-10 00:42:16 +00:00
Campbell Barton
e7a487d1e9 code cleanup: group python reset functions in BPY_python_reset() 2013-06-09 23:31:53 +00:00
Campbell Barton
7222d654b2 code cleanup: typo and stop manpage turning '$' into italic. 2013-05-25 02:21:50 +00:00
Sergey Sharybin
8360c14f14 Fix #35443: Animation player doesn't play some movie formats
Need to initialize FFmpeg for animation player.

This is a bit confusing, but the only way to do this
properly and clear is to call IMB_ffmpeg_init from
playback_mode command line callback.

This is because this callback is blocking and
"usual" FFmpeg initializetion (which happens after
command line parsing) was never called.

Could be switched to separate FFmpeg initializtion
and debug level set but let's keep simple for now.
2013-05-21 12:18:35 +00:00
Brecht Van Lommel
a07dcd67eb Fix #35240: command line -t number of threads option did not work for cycles.
Now it works for blender internal, cycles and other multithreading code in
Blender in both background and UI mode.
2013-05-08 13:23:17 +00:00
Sergey Sharybin
685e9b83c2 Fix for --debug-ffmpeg not giving enough information 2013-04-29 16:03:21 +00:00
Ton Roosendaal
53bb59f209 Accidentally left in test function. All's fine now! 2013-04-13 14:15:16 +00:00
Antony Riakiotakis
9e8047d37b Fix compilation, ifdef test_file just in case it is useful for later. 2013-04-13 14:05:31 +00:00
Ton Roosendaal
d867cefa32 Bug fix #34896
The feature "Keep Session" was also loading that session when you double-click
on a .blend to open it, or when a .blend file was on commandline.

Moved this feature to the main() in creator.c, so it can check on it properly, skipping the
kept session when a file was loaded.
2013-04-13 12:03:20 +00:00
Campbell Barton
a4520320ef fix [#34900] Building blender as a python module is broken in trunk
patch provided by reporter - Martijn Berger (juicyfruit)

also quiet warnings for headless mode.
2013-04-08 05:01:35 +00:00