Commit Graph

131 Commits

Author SHA1 Message Date
Morten Olsen Lysgaard
178502c8a6 CMakeLists.txt: use CMAKE_CURRENT_SOURCE_DIR instead of CMAKE_SOURCE_DIR to enable embedding of filament as a subdirectory in a larger CMake project. (#103) 2018-08-16 09:25:04 -07:00
Romain Guy
e439c779a2 Don't use $CMAKE_SOURCE_DIR, let's use $FILAMENT instead
See pull request #103
2018-08-16 09:08:57 -07:00
Cory Bloor
2dc0d278ac Enhance CMake compiler check on Linux (#102)
* Enhance CMake compiler check

This commit adds a check for compilers that don't meet the project's
minimum requirements. It will catch Clang versions that are too low as
well as any non-Clang compilers.

* Change SEND_ERROR to FATAL_ERROR
2018-08-15 18:05:02 -07:00
Philip Rideout
6d9668ccf6 Add unit test for cross cube images. (#101) 2018-08-15 15:36:17 -07:00
Romain Guy
7547cd9ee5 Update images for the documentation 2018-08-15 13:57:48 -07:00
Romain Guy
24dc24ce86 Add explanations about the Fresnel term 2018-08-15 13:13:48 -07:00
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
Romain Guy
9f2592ed9d Update SPIRV libraries (#99)
* Update SPIRV libraries

- Update `spirv-cross`
- Update `spirv-tools`
- Update `glslang`

`spirv-tools` contains a fix for an issue we reported (unnecessary promotions to highp in certain expressions).

* Add SPIRV-Tools dependency to matinfo
2018-08-15 12:59:17 -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
Romain Guy
b739ac8e86 Fold computations inside the branch 2018-08-14 18:15:01 -07:00
Romain Guy
65a42a518c Add material_testbed application (#97)
* Add material_testbed application

This application can be used to automatically vary material parameters over multiple frames and capture each frame as a PNG file. This makes it easier to test/compare/etc. It's also useful to generate documentation examples.

* Rename material_testbed to frame_generator
2018-08-14 18:01:31 -07:00
Philip Rideout
5a027ca5a2 Replace deprecated color xform funcs. (#96) 2018-08-14 15:19:40 -07:00
Philip Rideout
b5b90b83f8 Add test_cmgen and promote the "updateOrCompare" function. (#95) 2018-08-14 13:47:31 -07:00
shartte
e6d5a85ec8 clang-cl warning fixes (#83)
* Disable certain MSVC-specific deprecation warnings

* clang-cl.exe warning fixes
2018-08-14 12:55:04 -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
Romain Guy
bb553bf53d Fix uninitialized memory bug in cmgen (#93)
We recently changed the default constructor of vector to not initialize the vector to 0. This caused subtle issues in cmgen which was creating arrays of vectors. This change simply forces 0 initialization of those arrays.
2018-08-13 22:24:23 -07:00
Mathias Agopian
7fcefb5f54 make we our indices to the hammersley sequence are within range
fix #87

We just skip samples that have a dot(N,L)<0 which 
means we’re “loosing” some samples. However,
this happens higher levels of the mipmap chain,
and since we’re increasing significantly the 
number of samples as the level increases, this
doesn’t end-up being a problem.
2018-08-13 20:23:21 -07:00
Benjamin Doherty
7569ea6359 Fix build issues 2018-08-13 18:35:11 -07:00
Mathias Agopian
cf4325b8de improve windows init code
- handle errors during context creation
- handle errors when setting the swap chain
- don’t leak the context and dummy window
- don’t return dummy fences that don’t even work
2018-08-13 18:35:11 -07:00
Mathias Agopian
c2362fa2cd tidy code 2018-08-13 18:35:11 -07:00
Romain Guy
c429af310e Cleanup sample code 2018-08-13 17:01:04 -07:00
Romain Guy
42e319e074 Add white furnace IBL (#89)
Useful to test BRDFs and energy conservation
2018-08-13 15:51:44 -07:00
Philip Rideout
acffdb328a Fix release-only warnings. (#88) 2018-08-13 15:26:51 -07:00
Philip Rideout
143da431c1 Enable image comparison in unit test. (#86) 2018-08-13 12:31:04 -07:00
Romain Guy
45b36e9306 Add link to Python bindings 2018-08-13 12:23:52 -07:00
Romain Guy
3a538f90c8 Update docs 2018-08-13 12:22:53 -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
Philip Rideout
1f380a6ec6 Introduce new image library, Phase I. (#80)
* Overhaul the image library, Phase I.

The preps for our upcoming mipgen command line tool by adding filtering
capabilities and unit tests for a new LinearImage class, which will
subsume Image (deprecated).

Filament's new image library is composed of three components:

- LinearImage....simple 3D tensor of floats
- ImageOps.......free functions for simple transforms
- ImageSampler...high quality filtering

The old Image class was a simple untyped data blob and is now
deprecated. The new LinearImage class is always float32, and always
stores pixels in packed scanline order. This makes it easier to
implement image-based algorithms because they can be agnostic of the
underlying format.

Remaining refactorings:
- Phase  II will migrate imageio to LinearImage
- Phase III will migrate all downstream tools to LinearImage
- Phase  IV will remove old the Image class

* Image library code review feedback.
2018-08-13 10:39:57 -07:00
Romain Guy
c546890294 Add issue templates 2018-08-13 09:12:40 -07:00
Omar Shehata
41bbac7098 Fix typo (#85)
Fixing a typo in the overview section.
2018-08-13 07:44:31 -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
Romain Guy
9ac432d530 Fix continuous integration tests 2018-08-10 16:23:03 -07:00
Romain Guy
451d62e4de Fix artifacts location (#78) 2018-08-10 16:07:29 -07:00
shartte
6216b1a459 Remove more unsupported compiler flags when clang-cl.exe is being used. (#76) 2018-08-10 15:35:49 -07:00
Romain Guy
56d280a729 Exclude more tests 2018-08-10 15:14:39 -07:00
Romain Guy
5aab9b016f Fix tests list 2018-08-10 14:50:23 -07:00
Romain Guy
af13e385c1 Run unit tests in continuous builds (#75) 2018-08-10 14:31:41 -07:00
Philip Rideout
3e9979b75d Fix the surfaceCapabilities check. (#74)
Some Intel drivers report a max image count of 0, which is legit.

Fixes #71.
2018-08-10 13:28:59 -07:00
prideout
307f4782ae Disable hex mode after printing diagnostics. 2018-08-10 12:09:09 -07:00
Philip Rideout
fbe854e37d VulkanDriver now prints GPU info. (#73)
This is motivated by #71.
2018-08-10 11:58:03 -07:00
Romain Guy
263012384b Mac buils should inspect the job name (#72) 2018-08-10 11:19:52 -07:00
Mathias Agopian
8d2b3b2229 froxelization fixes (#70)
* fix stack corruption when the scene has more than 255 lights

* fix froxelization with more than 255 lights

Make sure froxelization works when the engine is
configured with more than a maximum of 255 lights.

The main issue was that the froxel structure on the
GPU uses 8 bits to encode the light count (per
froxel). So we have this 255 light max per
froxel limitation. The CPU code now honors this.

With this change we can go back to 256 lights
from 255!

All that said, it’s not recommended to increase
the maximum number of lights because the memory
usage on the CPU explodes. For instance we
go from 4 MiB with 256 lights to 18 MiB for 1024.
2018-08-09 23:07:24 -07:00
Romain Guy
12da05e249 Update docs 2018-08-09 17:41:07 -07:00
Mathias Agopian
d6746e1140 Set max number of lights to 255 instead of 256 (#66)
This always was the intention because internally 
it uses 8-bits buffers instead of 16-bits. One of
our temporary buffer goes from 4 MiB to 2 MiB.
This got mistakenly changed to 256 recently.
2018-08-09 17:30:59 -07:00
Philip Rideout
07c34ee833 Simplify Image by flipping RADIANCE images. (#63)
* Simplify Image by flipping RADIANCE images.

Unit test for the new flip() method is forthcoming.

* Optimize image flipping.
2018-08-09 17:30:17 -07:00
Romain Guy
0f20068775 Detect GCC before attempting a build (#64)
This change fixes #62
2018-08-09 17:12:37 -07:00
Romain Guy
6b1788fc6e Add about section 2018-08-09 16:06:50 -07:00
Philip Rideout
69b65d9e2d Rename ColorSpace header to ColorTransform. (#61) 2018-08-09 15:54:18 -07:00
Romain Guy
e5535c7a66 Rg/less warnings (#60)
* Fix warnings for real this time
2018-08-09 14:16:10 -07:00