Commit Graph

7436 Commits

Author SHA1 Message Date
Mathias Agopian
f5c0fabb10 matc: improvements to LineDictionary compression (#9078)
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.
2025-08-12 12:58:35 -07:00
Matthew Hoffman
c0e7f0c664 Add a filament backend test template. (#9071)
Also fix a small bug in image comparison when there is no file yet.
2025-08-12 19:29:37 +00:00
Powei Feng
0b4ec1c340 github: make mesa setup an action (#9081) 2025-08-12 19:13:31 +00:00
Ben Doherty
781083960c matp: Fix crash when reflecting parameters (#9089) 2025-08-12 13:50:17 -04:00
Filament Bot
b0b40375e1 [automated] Updating /docs due to commit af0f395
Full commit hash is af0f395884

DOCS_ALLOW_DIRECT_EDITS
2025-08-12 06:01:40 +00:00
Powei Feng
af0f395884 Filament targets c++20 by default (#9080) 2025-08-12 05:59:21 +00:00
Powei Feng
f91ba0867e filamat: remove webgpu workaround for opt passes 2025-08-11 15:47:59 -07:00
Mathias Agopian
f85955f77b canonicalize id pass must always run last 2025-08-11 15:45:23 -07:00
Mathias Agopian
a6d5231beb script for updating spirv-cross 2025-08-11 15:45:05 -07:00
Mathias Agopian
23d2027605 script for updating spirv-headers 2025-08-11 15:45:05 -07:00
Mathias Agopian
58d29cee86 script for updating spirv-tools 2025-08-11 15:45:05 -07:00
Mathias Agopian
d721b3f13d update spirv-cross to d8e3e2b 2025-08-11 15:44:45 -07:00
Mathias Agopian
538f497d4d update glslang to version 15.4.0
add a nicer script to update
2025-08-11 15:44:28 -07:00
Ben Doherty
e8e99a0de6 Fix: webgpu error regarding mismatched pipeline (#9056) 2025-08-11 17:30:07 -04:00
Ben Doherty
6630aa5f36 matp: Remove accidental switch fallthrough (#9082) 2025-08-11 17:26:46 -04:00
Powei Feng
bc83ffdcd1 vk: make default render target independent of call order (#9065) 2025-08-11 20:27:53 +00:00
Powei Feng
c21f211a13 Update java for Texture::Usage (#9055)
Also update samples and utils to use proper usage when
generating mipmaps.
2025-08-11 19:47:26 +00:00
Patrik Huber
58d4671c24 Fixes to frame_generator sample (#9050)
* [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.
2025-08-11 19:21:05 +00:00
Mathias Agopian
93caca7245 fig materialparser assert when shader is not present 2025-08-11 11:11:42 -07:00
Mathias Agopian
bf77c023b9 correctly set STENCIL Usage on color pass texture
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.
2025-08-11 11:11:22 -07:00
yein
95128d5f55 Follow up of material parser PR (#9029)
- Fix CMakeLists to correctly include src files in matp test
- Replace std::string to std::string_view
- Also update the test_includer.cpp
2025-08-11 18:05:10 +00:00
Powei Feng
6d17d858de vk: Fix bad layouts/formats when doing generateMipmaps (#9058)
- After genMipmap, transition to shader read layout
- Ensure that the staging image format is TRANSFER_SRC.
2025-08-11 17:49:15 +00:00
Sungun Park
05003ea358 mat: Add CRC32 validation for material packages (#9053)
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]
2025-08-09 00:03:56 +00:00
Matthew Hoffman
98847d6509 Simplify backend tests' EXPECT_IMAGE invocation. (#9052) 2025-08-08 21:55:37 +00:00
Mathias Agopian
d3828cdd1c fix the 3-parameters fresnel calculation
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]
2025-08-08 14:18:15 -07:00
Andy Hovingh
4beda6feee wgpu: fix Android build error 2025-08-08 15:32:18 -05:00
Juan Caldas
7cacef9509 Update GLSL for mip test (#9064) 2025-08-08 15:09:27 -04:00
Juan Caldas
5cd7de7318 Change fogReserved 2025-08-08 10:44:54 -07:00
Sungun Park
9c87e72a81 Correct warning message (#9059)
The subsequent call

`glGetShaderiv(shader, GL_COMPILE_STATUS, &status);`

will ensure the compilation is complete.
2025-08-07 22:35:26 -07:00
Filament Bot
652d973ad8 [automated] Updating /docs due to commit 8466177
Full commit hash is 84661777e7

DOCS_ALLOW_DIRECT_EDITS
2025-08-07 22:52:23 +00:00
Ben Doherty
84661777e7 Materials: add useDefaultDepthVariant flag (#9020) 2025-08-07 22:49:05 +00:00
Powei Feng
c8ab2f335e Fix places where generateMipmaps is called without proper usage (#9054) 2025-08-07 22:24:40 +00:00
Mathias Agopian
db14efc151 compress the DFG LUT with zstd
- 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.
2025-08-07 14:58:18 -07:00
Mathias Agopian
d1ca059dad resgen: add compression options
- with `-z` each resource is compressed individually
- with `-Z` the whole package is compressed
2025-08-07 14:58:18 -07:00
Mathias Agopian
c71a22914f small improvements to cmgen
- 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.
2025-08-07 14:58:18 -07:00
Mathias Agopian
71d0723026 add zstd to the build 2025-08-07 14:58:18 -07:00
Powei Feng
5c371089f2 Add GEN_MIPMAPPABLE TextureUsage (#9042)
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.
2025-08-07 18:14:49 +00:00
Konrad Piascik
2c7064e93d webgpu: skip PushConstants backend test for webgpu
We can revert this once dawn supports push constants
2025-08-07 11:07:02 -04:00
Filament Bot
3961989aca [automated] Updating /docs due to commit b92af35
Full commit hash is b92af357f7

DOCS_ALLOW_DIRECT_EDITS
2025-08-07 08:36:16 +00:00
Mathias Agopian
b92af357f7 add a material option to use linear fog calculations (#9030)
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.
2025-08-07 01:33:36 -07:00
Mathias Agopian
f2a1051df9 add CanonicalizePass optimization
this makes all spirv IDs much more stable which greatly improve the
utilization of the line dictionary.
2025-08-07 01:32:31 -07:00
Mathias Agopian
594ab3e9e3 spirv-tools update to vulkan-sdk-1.4.321.0 2025-08-07 01:32:31 -07:00
Mathias Agopian
7f18c7fd43 fix -d (matdbg) build option
There was two problems:
- tint was needed regardless of webgpu support
- libfilamat wasn't built on the android side
  (I don't know how it ever worked)
2025-08-06 17:29:51 -07:00
Powei Feng
9c1a252ba5 Fix two compilation errors (#9041)
- Include <limits> in bitset.h
- The type could not be inferred for Scene.cpp's `SharedState`
  line.  The failure came from clang version 1:14.0-55~exp2
2025-08-06 22:22:40 +00:00
Juan Caldas
bf8e798b60 webgpu: Set Layercount to 1 instead of 0 (#9038)
part of BUGS = [424157731]
2025-08-06 22:00:25 +00:00
Eliza Velasquez
b94e90416a Fix build breakage 2025-08-06 14:33:53 -07:00
Andy Hovingh
e9fde8346e wgpu: fix test seg fault due to null descriptor set layout label 2025-08-06 16:31:44 -05:00
Andy Hovingh
3ae747b544 wgpu: remove assumption default render target is present in makeCurrent(...) 2025-08-06 16:31:44 -05:00
Eliza
5924633085 gl: amortize shader compilation over N frames (#8964)
* 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
2025-08-06 21:09:27 +00:00
Juan Caldas
a07c19e5b7 Add missing WebGPU checks (#9037)
part of BUGS = [424157731]
2025-08-06 16:18:18 -04:00