Commit Graph

3120 Commits

Author SHA1 Message Date
Campbell Barton 915235c87a Cleanup: unused headers 2014-11-28 22:16:14 +01:00
Bastien Montagne f1ea1da5e5 BLI_bitmap: add allocation from a MemArena. 2014-11-25 21:09:13 +01:00
Campbell Barton 08fd38cf52 BLI_utildefines: add UNUSED_VARS() macro 2014-11-24 12:03:25 +01:00
Campbell Barton 7b0d6a1e6c SCons: correct include for win, also minor cleanup 2014-11-24 09:56:24 +01:00
Campbell Barton 73633388ff SCons: correct includes after recent refactor 2014-11-24 00:47:32 +01:00
Bastien Montagne 48a720055f Fix BLI_Bitmap - was not usable in BKE area (strict compile flags). 2014-11-23 20:51:08 +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 25c5542fe7 Math Lib: add constant: M_SQRT1_3 1/sqrt(3) 2014-11-22 18:21:52 +01:00
Campbell Barton 46e2d5ee41 Cleanup: typo 2014-11-21 14:16:35 +01:00
Sergey Sharybin 7b0c529fe2 Task scheduler: Add an option to limit number of threads per pool
This way we can have scheduler capable of scheduling tasks on all the CPUs
but in the same time we can limit tasks like baking (in the future) to use
no more than given number of threads.
2014-11-21 11:31:30 +01:00
Bastien Montagne 391096252b Fix T42638: Roll angle inconsistent flip in edit mode.
Basically, `angle_compat_rad()` was completely broken -
example of result it could produce:

| new angle | compat angle |    result
| -0.000000 |   3.141593   | -> 3.141593

... Where 0.0 (or 2 * PI) would be expected!
2014-11-20 15:02:48 +01:00
Campbell Barton 5efd2b7f36 correct another problem with BLI_assert
need to use extern C for C++
2014-11-18 10:56:31 +01:00
Campbell Barton b72eab5d6b Error in last commit (broke release build) 2014-11-18 10:24:24 +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
Campbell Barton 832a97f002 Macros: ELEM() can now take 2 args
Handy when used indirectly.
2014-11-16 14:29:17 +01:00
Campbell Barton c31f74de6b Cleanup: use BLI_listbase_count_ex to avoid redundant looping 2014-11-16 14:23:37 +01:00
Campbell Barton 0e60accf2a BLI_listbase: Add BLI_listbase_count_ex (sets a limit)
This can be used to avoid redundant looping when we only want to know if a list is smaller then some size.

also remove paranoid NULL check in list counting.
2014-11-16 14:06:03 +01:00
Campbell Barton 7d040d2a08 Cleanup: use BLI_listbase_*** prefix for count,sort,sort_r 2014-11-16 13:57:58 +01:00
Campbell Barton 60ffc08547 Cleanup: use BLI_hash_ prefix for md5 api 2014-11-14 11:53:27 +01:00
Campbell Barton 14795baf21 Cleanup: headers 2014-11-14 11:49:45 +01:00
Bastien Montagne 64c0c13e6e Add Murmur2A hashing feature to BLI
Murmur2a is a very fast hashing function generation int32 hashes.
It also features a very good distribution of generated hashes.

However, it is not endianness-agnostic, meaning it will usually generate
different hashes for a same key on big- and little-endian architectures.
Consequently, **it shall not be used to generate persistent hashes**
(never store them in .blend file e.g.).

This implementation supports incremental hashing, and is a direct
adaptation of reference implementation (in c++):
https://smhasher.googlecode.com/svn-history/r130/trunk/MurmurHash2.cpp

That cpp code was also used to generate reference values in gtests file.

Reviewers: sergey, campbellbarton

Reviewed By: campbellbarton

Projects: #bf_blender

Differential Revision: https://developer.blender.org/D892
2014-11-14 11:00:26 +01:00
Sergej Reich 52d571e189 Avoid calling powf with integer exponent in more places
Move powX functions from particle code into math library and use them.
2014-11-11 18:16:20 +01:00
Sergey Sharybin 988b3d7188 Add utility macros to clamp all elements of 2,3,4 component vectors 2014-11-04 16:31:42 +05:00
Campbell Barton 5e0e175422 Cleanup: spelling (D831) 2014-11-03 23:28:16 +01:00
Sergey Sharybin e43b74d87a Optimization of parallel range
It now supports different scheduling schemas: dynamic and static.
Static one is the default and it splits work into equal number of
range iterations.

Dynamic one allocates chunks of 32 iterations which then being
dynamically send to a thread which is currently idling.

This gives slightly better performance. Still some tricks are
possible to have. For example we can use some smarter static scheduling
when one thread might steal tasks from another threads when it runs
out of work to be done.

Also removed unneeded spin lock in the mesh deform evaluation,
on the first glance it seemed to be a reduction involved here but
int fact threads are just adding value to the original vertex
coordinates. No write access to the same element of  vertexCos
happens from separate threads.
2014-11-03 22:44:29 +05:00
Sergey Sharybin 7bb910cd4e Fix T42344: EWA filter produces blured results
Derivatives variable names are swapped in the old EWA filter code,
need to adjust for that.

TODO: Make naming fore clear in there.
2014-10-31 12:35:20 +01:00
Lukas Tönne af9da0be43 Complementary fix for rB8054372: Follow the common naming scheme by
using negate_mat3_m4 instead of negate_m4.

This avoids changing the behavior and only flips the 3x3 part of the
matrix.
2014-10-30 15:31:18 +01:00
Campbell Barton be63ba315f Math Lib: pseudoinverse_m4_m4 changed input matrix 2014-10-30 14:49:57 +01:00
Campbell Barton c2dc51d827 Math Lib: add transpose_m3_m3, m3_m4, m4_m4 2014-10-30 12:15:14 +01:00
Campbell Barton 0414ed1c48 Fix for mat3_to_rot_size modifying input matrix 2014-10-30 10:37:55 +01:00
Campbell Barton 8054372d22 Fix negate_m3 (taking 4x4 matrix)
Cycles bake used incorrectly.
2014-10-30 10:29:37 +01:00
Campbell Barton 133f79e449 Cleanup: warnings, typos 2014-10-29 14:15:21 +01:00
Campbell Barton eaaeae4699 Cleanup: spelling 2014-10-23 10:38:38 +02:00
Jason Wilkins 88fe896243 Checked each of my (jwilkins) XXX notes.
The ones in extern/glew-es have been changed to NOTE instead of XXX

GHOST_ContextEGL.cpp: It really does seem that it is not possible to query the swap interval using EGL

GHOST_WidnowCocoa.h: The comment referring to Carbon is clearly out of date, so I removed it.

math_geom.c: The node about not using tmax again is correct, but the code is kept for a future maintainer who will need to know how to compute it if they modify that code.

paint_image_proj.c (2698): The question about integer truncation does not appear to have been resolved.  It still seems to be an incorrectly implementation of rounding (I'd suggest using the round function instead of this hack).
2014-10-22 20:03:25 -05:00
Sergey Sharybin dfc4de036e Meshdeform modifier: Use threaded evaluation
This commit switches meshdeform modifier to use threads to evaluate
the vertices positions using the central task scheduler.

SO now we've got an utility function to help splitting the for loop
into tasks using BLI_task module which is pretty straightforward to
use: it gets range (which is an integer lower and higher bounds) and
the function and userdata to be invoked for each of the iterations.

The only weak point for now is the passing the data to the callback,
this isn't so trivial to improve in pure C.

Reviewers: campbellbarton

Differential Revision: https://developer.blender.org/D838
2014-10-22 12:20:41 +02:00
Campbell Barton 282315d991 ListBase: use BLI_listbase_ for new api calls 2014-10-21 14:06:16 +02:00
Bastien Montagne be4b2e42c6 BLI_listbase: add BLI_swaplinks which swaps given links' positions in given list.
Can be much simpler and quicker than using remlink/insert functions.
2014-10-21 12:07:24 +02:00
Campbell Barton 858e7b2f84 Correct last commit 2014-10-15 10:10:05 +02:00
Campbell Barton 2d50e5feaa Fix T42226: Glibc <= 2.8 fails to build 2014-10-15 09:23:43 +02:00
Bastien Montagne cd2295f93e BLI_bitmap: add a macro to set/clear the whole bitmap at once. 2014-10-14 09:40:35 +02:00
Campbell Barton a4258d40a1 BLI_utildefines: add SQUARE macro
also minor cleanup
2014-10-13 15:36:13 +02:00
Sergey Sharybin 504370cafb Code cleanup: Fix silly duplication of typecheck and swap macro 2014-10-10 21:13:19 +06:00
Campbell Barton 642c8243e7 BLI_buffer: empty macro 2014-10-10 10:10:13 +02:00
Campbell Barton 30dab51c29 Cleanup: use bool and const args 2014-10-09 22:44:03 +02:00
Antonis Ryakiotakis 5f6e47e767 Minor cleanup.
* Use pie direction, not draw type for pie item collision
* Strict function definitions.
* Initialize random array with system time
2014-10-09 17:12:32 +02:00
Antonis Ryakiotakis 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
Campbell Barton 15af15eb56 BLI_buffer: simplify buffer resize 2014-10-05 10:33:02 +02:00
Campbell Barton bc0411f687 Fix for 2-sided faces in array modifier 2014-10-03 14:36:34 +02:00
Sv. Lockal 5ecbd5c871 Use native float math functions for MSVC12
`double` surrogates are slow (e.g. pow is 2x slower than powf), and MSVC12
supports fp-math functions from C99.
2014-09-30 13:39:03 +04:00
Kévin Dietrich 570313d519 Blend modes: fix array length being too short
Reviewers: psy-fi

Differential Revision: https://developer.blender.org/D799
2014-09-30 10:48:57 +02:00