This is a simple place to host WebGL demos and tutorials, we can prettify later. It will show up at:
https://google.github.io/filament/
The hugo config specifies the output holder to be ../docs which is where our GitHub Pages site is located.
Note that this commit adds the *source* to the site, it does not publish the actual site. When we're ready to publish the actual site, we'll do:
```terminal
cd site ; hugo ; cd ..
git add docs ; git commit
```
WebGL does not always honor the invariant GLSL decoration, so we cannot
allow the depth prepass on web.
This fixes the black flakes seen with the Intel HD Graphics 615 in
Pixelbook laptops.
* Clean-up EntityManager a bit
- use tsl::robin_set instead of std::set (which should have been unordered::set
anyways).
- getListeners() now returns a vector which avoids to traverse a set twice.
Turns out that copying the set wasn't as efficient as I thought.
* Improve jobsystem a bit
We recently added a job reference counting mechanism, but we were a bit
too aggressive about taking/release references.
Also make the API more complete by adding explicit retain/release,
which is needed to allow several threads to wait on the same job.
Also improve futex code by inlining it.
While this solves the builder leak, it does not solve the tiny leak
incurred every time you call `getInstance` on a component manager
without calling embind's `delete` method afterwards. Since there's no
way to auto-delete component instances, this CL fixes up our sample
code and docstrings.
Fixes#429
* Minor clean-ups
- fix a couple usage of std::function
- fix a couple usage of std::string
- remove ALIGN_LOOP, which didn't work
- fix a couple explicit/noexcept
- virtual -> override
* Fix spelling typos and other minor clang-tidy
We used to assume 32-bytes cache lines when running on ARM 32-bit mode,
however, that was wrong because 32-bit mode doesn't change the cpu's
cache line. On all modern platforms we support, the cache line
is 64 bytes.
Set Job storage to 48 bytes on all platforms.
* Fix a reuse after free in the job system
Jobs were destroyed and recycled while still in use
by wait() or run(). To fix this we introduce reference-counting of
jobs.
Jobs start with a ref-count of 1, which is decremented when a job
naturally finishes. Additionally, all user-facing methods acquire
a reference for the duration of the call.
* Fix an API inconsistency with JobSystem
JobSystem's API lets the user create jobs but not destroy them.
Jobs are destroyed automatically, without a way for the caller to
know when that happens.
We now explicitly enforce that jobs are no longer valid when
wait() returns. Multiple concurrent wait() are allowed however.
This is enforced by clearing the job pointer upon returning
from JobSystem::wait(Job* job).
* Rename linked-list put/get to push/pop
* Better fix for Job use after free
There was still a race condition where a run()'ed
job could be destroyed before wait() was called,
wait would then use a destroyed object.
The available APIs now are:
run() - runs and destroys a job
runAndWait() - run, then waits for and destroys a job
runAndRetain() - runs and keep a reference to the job
wait() - waits and destroys a job
wait() can only be used with a job obtained with runAndRetain().
* Get rid of unused code
This version of parallel_for has use-after-free issues anyways,
since we changed the semantics of run/wait/etc...
* Fix decRef() memory order
decRef() must ensure that all access to the
object have happened before destroying it.
* Fix memory order in atomic linked list's pop()
It needs acquire semantic, since we want to make
sure that no read/write are reordered before the
pop() -- which returns an object to the caller.
* Fix memory order on runningJobCount
we needed acquire semantic when about to destroy
the last job -- it's similar to decRef.
* Comment usages of std::memory_order_*
* Fix AtomicFreeList A-B-A bug
Turns out AtomicFreeList was not immune to the ABA bug. W're fixing
it here by using a 64-bits CAS, which is available on aarch64 and armv7.
Note that we need to allow clients to find out if compressed textures
are supported BEFORE the engine is created, so that they can start
downloading the correct set of texture files. To allow this, we now
expose a getSupportedFormats function that creates a throw-away canvas
in order to query extensions (creating a temporary canvas is a technique
that we also used in the old PNG decoder that we removed in 7b36ed4)
These are broken and no longer necessary now that we have web/samples.
Despite the name, these weren't real tests; they were ignored by CMake
and did not run in an automated manner. Going forward we need a better
solution for automated testing.
It turns out that it degrades performance even in cases where we
thought it would help. It seems to always trigger a "glFlush"
and has a very large CPU overhead. It looks like
glInvalidateFramebuffer() does a better job.
IF an UBO is marked as STREAM, meaning that data will
change every frame and the buffer content is invalidated
as well, then we use map/unmap buffer in asynchronous
mode to copy the data into the buffer.
This assumes the buffer is sized to be significantly
larger than the average amount of data used every
frame.
This makes our createTexture* helpers more consistent with the
createMaterial helper, and extends the wrapped Engine class with new
methods.
Before, clients did something like this:
const ao = Filament.createTextureFromPng(Filament.assets['foo.png'], engine);
...
engine.destroyTexture(ao);
Now, they can do:
const ao = engine.createTextureFromPng('foo.png');
...
engine.destroyTexture(ao);
This is more symmetric and concise. In general the JS API now supports a
class of "buffer-like" objects which exploit dynamic typing in order to
accept any of the following: BufferDescriptor, asset string, or
Uint8Array.
This test recreates a renderable every few frames and dumps the heap
pointer to the console so we can check if it increases over time.
Also simplified the personal web server script so that it uses twisted
and avoid doing a chdir, seems to be more reliable this way.