Commit Graph

13 Commits

Author SHA1 Message Date
Mathias Agopian
2bdf4c7911 use pointers instead of std::array<>::iterator (#100)
some STL implementations assert when iterators are
out of range (even without dereferencing).
2018-08-15 12:59:28 -07:00
Mathias Agopian
3d3f169a63 MSVC's STL doesn't let iterators go before begin() (#98)
* MSVC's STL doesn't let iterators go before begin()

This is the case even of the iterator is not
dereferenced. Fix #94.

* cleanup
2018-08-14 22:26:39 -07:00
Mathias Agopian
d9ba3998d2 JobSystem now automatically free Jobs (#91)
* JobSystem now automatically free Jobs

Until now Job allocation used a linear allocator
strategy which required to “reset” the JobSystem
periodically — typically once per frame in
filament.

This is no longer required. We use a pool allocator
now, which doesn’t add much overhead. It does
use a spin-lock for thread-safety though, since
we assume very little contention, this shouldn’t
be a problem.

* Thread Safe Object Pool Allocator

A lock-less, thread-safe object pool allocator,
now used for storing JobSystem’s jobs allocations.
This gets rid of the spin-lock introduced in the
previous cl.
2018-08-13 22:25:15 -07:00
Mathias Agopian
c91d2aedd8 per-light multithreading works again for froxelization
We spawn MAX_LIGHTS/32 (currently 8) jobs and
multi-threading is active as soon as we have more
than one light. All jobs work on disjoint buffers
to avoid false sharing between threads.

It’s possible to adjust roughly the number of jobs
by changing the group size (currently 32). However
this also affects vectorization.

With the current parameters, with 256 lights max
we get 8 jobs, and 4 spot-light test / froxel.
2018-08-13 11:36:24 -07:00
Mathias Agopian
7b7bd85def New froxelization algorithm that uses much less memory
Instead of building a list of froxel per light,
we now build a bitfield of lights per froxel.
To keep the code efficient we have to split
the bitfield array in 4, so that we can use
multiple threads without having them or’ing
each other’s cache-lines.

This data structure is also what we want in 
froxelizeAssignRecords(), and the conversion from
one format to the other is much faster.

Our internal data structure is now 256 KiB
instead of 2 MiB. It would be 1 MiB for 1024 lights
(down from 16 MiB)

Additionally, because the code is simpler, we get
more vectorization, especially with spot-lights.

One draw-back of the current version is that
multi-threading happens only every 64 lights.
This will be fixed later.
2018-08-13 11:36:24 -07:00
Mathias Agopian
a4851ed835 fix a bunch of clang-tidy warnings
fixed a couple actual real bugs (missing returns 
in operator=, wrong implicit bool conversion).

mostly added a bunch of explicit ctor.
2018-08-10 20:53:58 -07:00
Philip Rideout
fbe854e37d VulkanDriver now prints GPU info. (#73)
This is motivated by #71.
2018-08-10 11:58:03 -07:00
Ben Doherty
520ff90f34 Fix pathing issues on Windows (#49) 2018-08-08 12:17:30 -07:00
Romain Guy
2b9a383c8b Prevent compilation error on Windows (#31)
The compiler cannot infer the type of the constructed object when
using the shorthand syntax.
2018-08-07 09:45:25 -07:00
Mathias Agopian
94c3623c1c clean-up formatting
Change-Id: I2071e53cceb93cbe02d6bdfa238aa6ce770b0534
2018-08-06 18:14:11 -07:00
Damianno19
9d14f6e907 Fix error
utils\src\Profiler.cpp(61): error : no member named 'uninitialized_fill' in namespace 'std'
2018-08-06 14:44:29 -07:00
Tact Yoshida
ad49986245 Remove execute permissions 2018-08-06 10:36:54 -07:00
Romain Guy
b3d758f3b3 Initial commit 2018-08-03 10:38:22 -07:00