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.
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.
* 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.
* 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.
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.
* Add new Cloth NDF
Based on the work by Estevez and Kulla, also known as the "Charlie" sheen.
* Restore DFG computation to GGX
* New proposed approximation for Cloth DFG
* Add "Charlie" cloth DFG approximation to cmgen
* Switch to "Charlie" sheen for cloth shading
* Document the new cloth NDF and DFG approximation
* Fix post-process shader when not in Vulkan
The post-process shader must not flip the source texture when we compile for OpenGL. This happens because we use SPIR-V/Vulkan as an intermediate format.
* Fix the Android build
We need to output a location when targeting SPIR-V for mobile.