We're using timed condition variable in one place, but the STL version
pulls in a lot of code because it does clock calculations in
"long double" (!!!!). Since we already had an implementation
of condition_variable, we just add the timed version.
This saves several KiB of code.
Also don't use unique_lock() lock/unlock because it can throw exceptions.
The Pool wasn't used much anymore, since we're explicitly copy
the data into the command stream. Moreover, it generated a lot of code
and in fact was probably less efficient than malloc itself --
I think this was a misguided optimization in the first place.
This removes a lot of heap allocations/deallocations, and reduces
code size. Most improvements come from using CString and
StaticString instead of std::string and better using move
semantics.
Aaron pointed out that this error is easy to run into and quite cryptic
since one value is decimal and the other is hex. Users might not be
aware that one of them is a bitmask, and that this is related to how
they invoke matc or filamat.
In practice this limits materials to 10 samplers since Filament uses 5
for lights and skips 1 slot for the post-process sampler. This can
probably be optimized.
We now check for sampler overflow during material compilation rather
than waiting for run-time checks. This allows for Kokoro-based
validation of sample materials, and allows developers to catch this
issue in their asset pipeline.
We should also probably raise the upper limit (Qualcomm allows up to 16
samplers in their Vulkan implementation) but that can be a separate PR.
Fixes#507
This caused regressions with some of our samples like vk_hellopbr:
- For the new 1x1 textures, RGB isn't accepted by Vulkan and Metal.
Currently these platforms require RGBA, although we plan on adding
reshaping functionality for the future.
- Too many texture samplers in a single shader, this causes a run time
error. This could be alleviated by creating an atlas.
- vk_hellopbr assumes that all materials have a "metallic" param.
Going forward, we plan on creating a new library that avoids MeshAssimp,
so for now let's just disable gltf_viewer.
This fixes the "shader is not ASCII" error seen with GL backend,
introduced when we changed blob ownership semantics to accommodate
shader compression. It was due to missing null terminators.
We actually never bothered including the trailing null in blob length,
which was wrong but happened to work because the BlobDictionary held a
weak reference to chunk data. SInce it now holds an actual copy, the
lack of null caused our strings to contain garbage memory.
Since we use this for decoding, this adds a dependency to the core
filament renderer which in practice is only used for Vulkan. However
this is a tiny library, so it's simplest just to always include it.
The next PR will add the actual compression / decompression code to
filaflat and filamat. Here are the preliminary results.
102K => 29K aiDefaultMat.filamat
102K => 29K aiDefaultTrans.filamat
21K => 5.0K bakedColor.filamat
22K => 5.2K bakedTexture.filamat
21K => 5.0K depthVisualizer.filamat
40K => 10K groundShadow.filamat
102K => 29K sandboxCloth.filamat
125K => 36K sandboxLit.filamat
126K => 36K sandboxLitFade.filamat
126K => 36K sandboxLitTransparent.filamat
109K => 31K sandboxSubsurface.filamat
21K => 4.9K sandboxUnlit.filamat
21K => 4.9K transparentColor.filamat
Both the "before" and "after" numbers are excluding non-Vulkan targets,
and I also changed our CMakeLists to build filamat instead of inc.
Recall that Vulkan has a right-handed NDC system. Currently, our Vulkan
backend is not handling VERTEX_DOMAIN_DEVICE correctly, but we didn't
notice because the culling mode is not honored yet (a separate PR is on
the way for that).
To fix this, we considered adding a shader-based fixup only for the
device domain and keeping our Vulkanish projection matrix as-is.
However, this would cause the skybox shader to compute an incorrect
wrong eye vector due to in the inconsistent definition of clip space.
After discussion with Mathias and Ben, we decided that the most elegant
fix is for Filament to have only one canonical clip space, which for
now is the clip space that OpenGL requires.
Ben pointed out that spirv-cross has a flag for injecting shader-based
fixups. However we don't invoke spirv-cross for the Vulkan target, and
it's easy just to do this on our own.
PipelineState contains the program and raster state, more
state might be added in the future. Currently it is passed by value
and doesn't have a HwHandle, but this may change in the future.
This adds a few new functions to the JavaScript bindings. It also adds
our JavaScript docs into the CMake build system for machines that meet
the Python requirements.