We can significantly improve the effectiveness of the line dictionary
by splitting lines strategically. spirv optimization tends to create
new variable names (e.g. _1234) that are not always stable between
variants, hereby preventing lines from being duplicated. By simply
splitting lines around these patterns, we improve the effectiveness
of the compression.
The decompression is almost unchanged. To make the code easier, we
now keep the '\n' at the end of lines in the dictionary. That's the
only change to the decompression side.
On certain materials like aiDefault.mat the compression ratio is
improved from 2.8x to 15x.
This also fixes a small but where the line dictionary relied on the
last line of the input to be a newline.
* [Fix] frame_generator sample: open ifstream with ios::binary
* [Fix] frame_generator sample: allocate storage for g_materialBuffer
reserve() merely reserves memory, but does not actually change the size of the vector.
* [Fix] frame_generator sample: destroy materials/renderables during cleanup
Otherwise the sample crashes with a Filament error saying that the material is still associated with a renderable.
the framegraph didn't set the Usage::Stencil on textures it created
for the color pass if stencil was requested. On the GL backend it
didn't matter because that bit is unused.
This commit introduces a CRC32 checksum to material packages to ensure
data integrity.
When a material is loaded, this checksum is verified. If the check
fails, an error is logged, and the material fails to load. For older
material packages without a CRC32 checksum, a warning is logged and
proceed.
BUGS=[373396840]
it would automatically degrade to the 2-parameters version in
LOW_QUALITY mode, but some other code relied on the proper calculation,
in particular when specularFactor was used.
FIXES=[436866605]
- use resgen to package the DFG LUT into filament, instead of using
a large include of a C array.
- add a zstd compression step, which reduces the size from ~100KB to
~75KB.
The overhead of zstd is about 90KB uncompressed, however it will pay
for itself tenfold when we use it to compress material packages.
- when generating the DFG LUT as a text file, make sure to faithfully
reproduce the command used in the comments
- add a "bin" format that will output a headerless raw binary of the
LUT data.
This will allow for more backend-specific usage mapping then before - where BLIT_SRC and BLIT_DST are assumed for textures whose mipmaps will be generated.
These mappings have been introduced in metal, vulkan, webgpu.
The new `linearFog` material property, when set to `true` enables a
simplified fog calculation. The fog equation becomes linear which is
unrealistic, but more efficient to compute. In some situations with
a shallow fog range, it doesn't make a huge difference visually.
In this mode, height falloff and in-scattering are ignored.
The linear equation slope is calculated from the regular parameters to
match the slope of the real equation at a camera height. If
`heightFalloff` is disabled, set to 0, the `density` parameter
exactly corresponds to the slope of the equation in [1/m] units.
* gl: amortize shader compilation over N frames
On platforms which don't support parallel shader compilation (e.g. Firefox), we
can sort of emulate it by queueing up any requests to `Material::compile()` and
compiling each shader over multiple frames.
Compiling over consecutive frames slows things quite noticeably. Instead, space
each compilation over a number of ticks (16 chosen arbitrarily).
If we need a program NOW, we can bump a program queued for much later to the
front. We also avoid compiling any queued programs on this same frame to limit
stuttering.
* gl: add flag to disable amortized shader compile
If this flag is on, the new amortized compile code should theoretically never be
executed.
* gl: add CompilerPriorityQueue docs, Java API
* gl: amortize shaders, z3moon feedback
* gl: update CompilerThreadPool