Commit Graph

585 Commits

Author SHA1 Message Date
Antony Riakiotakis
d58a15c0a6 Windows: Add stacktrace support when unhandled exception occurs.
We need to register the exception handler slightly differently here, as
well as adding DbgHelp as a library, but according to docs it should be
supported in recent Windows editions (Win XP included even).

We can try it first and revert if there are issues.
2015-03-03 13:39:15 +01:00
Sergey Sharybin
3ec9b8e0c2 Purge temporary files on abort
This way both BLI_assert() and abort() called directly shouldn't
leave any files in the temp folder.

Previously it was really possible to have gadzillions of files
left over because of assert failures and debug aborts during the
development process.
2015-02-14 01:30:36 +05:00
Bastien Montagne
d40ac45610 Fix (unreported) load_file() func from creator.c not setting G.save_over correctly.
This was rather annoying, since if you were script-editing a .blend file in background
mode, opened through this commandline option system,  and wanted to save over,
a mere `bpy.ops.wm.save_mainfile()` *would not* overwrite expected file,
but instead write/replace the dummy `untitled.blend` one!
2015-02-12 17:30:19 +01:00
Bastien Montagne
fca515838e Cleanup: strcmp/strncmp -> STREQ/STREQLEN (in boolean usage).
Makes usage of those funcs much more clear, we even had mixed '!strcmp(foo, bar)'
and 'strcmp(foo, bar) == 0' in several places...
2015-01-26 16:59:24 +01:00
Sergey Sharybin
4d4456015c Quit blender with non-zero exit code if tryign to use non-existing render engine via the command line 2015-01-22 15:23:09 +05:00
Jens Verwiebe
70b6c82fd3 Fix an odd line that slipped in my ghost_hack_first_file commit 2014-12-30 18:31:37 +01: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
Campbell Barton
08fd38cf52 BLI_utildefines: add UNUSED_VARS() macro 2014-11-24 12:03:25 +01:00
Campbell Barton
43fa4baa6c Refactor: BLI_path_util (part 2)
Use BKE_appdir/tempdir naming prefix for functions extracted from BLI_path_util
2014-11-23 18:55:52 +01:00
Campbell Barton
6308c16675 Refactor: BLI_path_util (split out app directory access)
This module is intended for path manipulation functions
but had utility functions added to access various directories.
2014-11-23 18:42:18 +01:00
Campbell Barton
94f0d18470 BLI_assert: print a backtrace with the error
Add BLI_system_backtrace()
2014-11-18 00:20:56 +01:00
Sergey Sharybin
80d1d624d3 Support dynamic loading of SDL libraries
This is mainly to address old issue when one need to have SDL library installed
in order to use our official builds. Some hip distros already installs SDL,
but it's not quite the same across all the variety of the distros.

We also now switching to SDL-2.0, most of the distros have it in repositories
already, so it shouldn't be huge deal to install it if needed.

Reviewers: campbellbarton

Reviewed By: campbellbarton

Differential Revision: https://developer.blender.org/D878
2014-11-17 17:43:18 +05:00
Campbell Barton
2f87db681a Debug: print output on --debug-fpe
in practice often we want to breakpoint here (instead of flooding output)
but its confusing the option does nothing in release builds.

Devs can comment out locally.
2014-11-05 13:30:24 +01:00
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