Commit Graph
6909 Commits
Author SHA1 Message Date
Doris Wu 85e2cc0844 Create data transmitting class for fgviewer (#8332)
* Introduce FrameGraphInfo class

* Move the assignment into pimpl

* Make ctors explicit

* Add ctors to fg info structs

* Revert the macro change to align with existing

* Address the comments

* Remove pimpl and move func def to .cc

* Fix

* Address the comment
2025-01-18 02:47:22 +00:00
Mathias Agopian bef849b0e3 large code cleanup (#8364)
* Remove redundant qualifiers in filament public headers

* remove redundant qualifiers in filament implementation

* remove redundant qualifiers in libutils public headers

* remove redundant qualifier for libutils implementation

* remove redundant qualifiers for libmath

* use is_same_v<> instead of is_same<>

* bring back Builder::name()

we keep Builder::name() on all object, and forward to the MixIn class
that does the implementation, so that we have correct documentation, and
better IDE completion.

* add missing const parameters in filament's implementation

* various source cleanup

- missing includes
- missing const
- C cast style
- superfluous inline keyword
2025-01-17 17:50:16 -08:00
Mathias AgopianandPowei Feng 1747ae8f5a validate MaterialInstance references when destroyed (#8366)
* validate MaterialInstance references when destroyed

With this change we now enforce two things:
- All MaterialInstance of a Material must be destroyed when
  destroying said Material. This has always been a documented 
  requirement of the public API, but wasn't enforced (only
  a warning was printed).
  This new assertion is unconditional.

- A MaterialInstance, when destroyed is no longer in use by any
  Renderable.

So before destroying a MaterialInstance, the user of API needs to 
ensure that either all Renderable using that MaterialInstance in one
of their Render Primitives are  destroyed, or, that these Renderable
using that MaterialInstance are reset to another one or to null.

There is a new RenderableManager::clearMaterialInstanceAt() that can
be used to clear a MaterialInstance on a Render Primitive.
  
Additionally, a Render Primitive with a null MaterialInstance is now
silently skipped during rendering, instead of a null-dereference.

Finally, that second assert is protected by a new feature flag: 
"features.engine.debug.assert_material_instance_in_use". This flag is
enabled on DEBUG builds and disabled on RELEASE builds by default.
The flag can be changed at any time using `Engine::setFeatureFlag()`.

BUGS=[333907416]

* Update filament/src/components/RenderableManager.cpp

Co-authored-by: Powei Feng <powei@google.com>

---------

Co-authored-by: Powei Feng <powei@google.com>
2025-01-17 14:15:15 -08:00
Sungun Park 4c3a3241ca Fix compile & linker warnings (#8356)
Fix warnings emitted during the Filament compilation using CLion and
./build.sh script.

BUGS=[390207431]
2025-01-17 17:53:09 +00:00
Powei Feng c49d72e7d3 vk: properly destroy swapchain on recreate (#8365)
Fixes #8185, #6445
2025-01-17 06:39:05 +00:00
Mathias AgopianandPowei Feng 7c6463d01a update the documentation regarding STL usage (#8358)
* update the documentation regarding STL usage

* Update CODE_STYLE.md

Co-authored-by: Powei Feng <powei@google.com>

---------

Co-authored-by: Powei Feng <powei@google.com>
2025-01-16 16:23:01 -08:00
Powei Feng e6b15a90e9 renderdiff: fix mesa deps (#8362)
There are some packages that cannot be installed with
 apt-get -y build-dep mesa

We manually add those packages wrt to the expected clang version.
2025-01-16 23:20:40 +00:00
Benjamin Doherty e1024123c1 Release Filament 1.56.6 2025-01-16 12:59:55 -08:00
Mathias Agopian 24ae0b20f3 Fix wrong comment on unlikely directive
Fixes #8325
2025-01-16 10:52:11 -08:00
Mathias Agopian 288e81fb31 Fix DEBUG_COMMAND_STREAM mode
Fixes #7966
2025-01-16 10:51:56 -08:00
Powei Feng c435fc74c4 renderdiff: add initial code for updating goldens (#8349)
- Code for parsing tag in commit message
- Add placeholder for pulling and updating goldens in the script.
2025-01-16 07:08:48 +00:00
Mathias Agopian eac99e5796 remove all remaining references to SamplerGroup 2025-01-15 16:17:16 -08:00
Powei Feng 97e7058037 docs: add script to download mdbook (#8351)
We add a bash script to download and install mdbook. For
linux or mac x86_64, we download prebuilts from github.
Otherwise, we use `cargo install` to build it with rust.
2025-01-15 22:18:47 +00:00
Ben Doherty ac0aea98c9 Fix Web build, update Emscripten SDK to 3.1.60 (#8350) 2025-01-15 11:42:39 -08:00
Powei Feng 026b985c07 docs: new page with mdbook (#8342)
- Use mdbook to generate a book from collection of documents
 - documents are
     - copied and processed from READMEs
     - original content stored in the docs_src folder
     - markdeep docs transformed into embedded html
 - Main logic is in script docs_src/build/run.py
2025-01-14 06:56:30 +00:00
Powei Feng 65c30f3199 renderdiff: fix llvm-18 dep problem (#8347)
The public dep for mesa has moved on to beyond llvm-18, but the
version we're compiling against is not supported by this change.
We workaround by ensuring that the llvm dep is less than 18 but
consistent with the clang version.
2025-01-13 23:34:42 +00:00
Powei Feng da99a0385c vk: print error code on failure for vk calls (#8348)
Fixes #8186
2025-01-13 15:18:52 -08:00
Mathias Agopian 37fd83af66 Add support for an Atlas allocator for shadow maps
This feature is controled by a feature flag and is turned off at this point.
This CL shouldn't change the existing behavior of shadowmap allocation as
long as the atlas feature is not enanled.

When enabled, shadowmap allocations are not limited to layers of the
shadowmap texture, instead, an atlas is used meaning a layer can
be shared by multiple shadowmaps. At the very least this can save
a lot of memory as smaller shadowmaps can be packed together.

Currently this feature breaks some VSM features:
- mipmapping
- blurring
2025-01-13 15:10:14 -08:00
Mathias Agopian 3abf131066 Trivial clean-ups that shouldn't affect the behavior
We add an offset to the shadowmap viewport, but in this change
it is always set to (0,0)
2025-01-13 15:10:14 -08:00
Mathias Agopian 2b0077eea2 AtlasAllocator fixes
- when inserting an entry at a root other than zero, we need to update
  the children count of the root's parent.

- the QuadTree array nodes need to be able to encode enough indices for
  the largest "layer" in the tree. With 7 layers the largest one has
  4096 entries, so we need 12 bits, not 8.
2025-01-13 15:10:14 -08:00
MinGyuJung1996 90a4c88a0c Fix: combine-static-libs.sh in macos universal 2025-01-13 14:18:38 -08:00
Mathias Agopian d524bca73d fix a typo that prevented some spot shadows to appear 2025-01-13 14:15:44 -08:00
Sungun Park 29d2d819e3 Release Filament 1.56.5 2025-01-08 21:59:14 +00:00
Ben Doherty 863b1346e1 Rename IOS define to FILAMENT_IOS (#8340) 2025-01-08 13:11:39 -08:00
Powei Feng f0b9a30bc1 matdbg: add option to hide inactive materials and variants (#8339)
The option will persist beyond user sessions through localStorage.
2025-01-07 19:42:17 +00:00
Powei Feng a003d3721d matdbg: enable source formatting (#8338)
We use clang-format to format the shader files. Since we assume
clang is necessary for compilation, installing clang-format should
not be too much of an overhead in terms of adding dependency.

Currently, we only support posix systems (macOS, linux).
2025-01-07 18:11:12 +00:00
Mathias Agopian ef6ef784c9 external textures are no longer restricted to SAMPLER_EXTERNAL
OpenGLES allows this when GL_OES_EGL_image is present.
2025-01-07 09:50:57 -08:00
Mathias Agopian 7d271cea1d remove backend deprecated and unused APIs 2025-01-07 09:50:57 -08:00
Powei Feng 7d0b652663 matdbg: fix two memory bugs (#8337)
- murmur3 expects word size not byte size
 - should use uint8_t in addressing blob source.

both would crash when asan is enabled.
2025-01-06 18:33:25 +00:00
seker 8c1e028b46 Fix : null pointer crash (#8326) 2024-12-30 11:42:18 -08:00
Doris Wu 757e3c57d8 Add skeleton code of fgviewer (#8303)
* Skeleton of fgviewer debug server

* Update the map for fg info

* Add ApiHandler skeleton class

* Format the files

Format the file

* Prevent fgviewer being built before ready

Add comment to fgviewer related lines

Fix cmake commands

* Update the copyright

* Address the comments

Address the comments

* Address the comments

* Specify the debug server

* Fix build options
2024-12-20 23:20:54 +08:00
Powei Feng aa09d86b5a matdbg: Fix material collision (#8322)
Fix 3 bugs wrt matdbg:

1. The numbering scheme for materials with same name was buggy
2. The shared depth variants of the default material should also
   show up as active material variants.
3. When two instantiation of FMaterial point to the exact same
   bits, we still need to treat them as two materials. (Otherwise
   we wouldn't be able to modify one of them in matdbg).
2024-12-19 20:14:08 +00:00
Ben Doherty 1f1389e668 Metal: avoid crashing for invalid programs (#8321) 2024-12-19 10:00:51 -08:00
Pei Jia 32abd9ea90 Solve the bug: filament error: first argument in call to 'memcpy' is a pointer to non-trivially copyable type 'value_type' (aka 'filament::DescriptorSet::Desc') [-Werror,-Wnontrivial-memcall]
152 |     memcpy(set.mDescriptors.data(), mDescriptors.data(), mDescriptors.size() * sizeof(Desc));
2024-12-18 11:46:13 -08:00
Mathias Agopian 8724995042 TAA fixes and improvements
- use a lanczos filter for sampling the color buffer, instead of a
  blackman-Harris window. This improves sharpness quite a bit.

- some cleanups of the shader code

- never use YCoCg when rectification is not enabled.

- fix the calculation of the confidence paramter when upscaling is used.


Upscaling works a lot better now, but it is still work in progress.
2024-12-17 21:49:00 -08:00
Mathias Agopian e75bf2f40f Fix an assert that prevented instancing to work
FIXES=[384588566]
2024-12-17 21:48:13 -08:00
Powei Feng 45b0164c84 Release Filament 1.56.4 2024-12-17 16:39:29 -08:00
Powei Feng 8ddc4d3060 Fix compilation material failure log (#8317) 2024-12-18 00:27:05 +00:00
Mathias Agopian 377a1106aa Add a way to set the shadow sampling quality
FIXES=[379754325]
2024-12-17 16:07:40 -08:00
Doris Wu 6a547639d1 Specify the source of server log (#8313) 2024-12-14 10:28:59 +08:00
Mathias Agopian d2e85290fe update web samples and remove ui 2024-12-12 22:21:42 -08:00
Powei Feng 49d89298f8 renderdiff: allow for explicit (compile-time) linking of osmesa (#8301)
If the shared osmesa lib is not found, then we assume that the
library has been compile-time linked via the linker.  This is to
accommodate build frameworks where compile-time linking is
preferred.
2024-12-12 06:22:43 +00:00
Powei Feng 6a772bf715 vk: fix typo that caused debug builds to fail (#8309) 2024-12-11 19:39:04 -08:00
Powei Feng 23847c4314 vk: Use-after-free coverage (#8273)
To allow for use-after-free discovery with ref-counting, we keep
a bit to indicate whether the handle is considered destroyed by
Filament. We assert against "cast"-ing a destroyed handle.
2024-12-12 00:53:00 +00:00
Thoren Paulson 96278f7999 Fix shadow cascade calculatioins
The `ShadowCascade` functions for computing splits all attempted to clamp `cascades` to [0,4] (evidently to avoid out-of-bounds access), but used `max`, instead giving a range of [4, x].

For applications using less than 4 cascades, this results in incorrect split locations and lower quality (much more obvious seam between cascades).

This change just switches to use `min` to ensure `cascades` is in the range [0,4].
2024-12-11 16:21:44 -08:00
Mathias Agopian ba6bee10f7 matc: remove access to public functions that should be undefined
When tangents are not supplied in a material, all "normals" related
public methods become undefined; remove access to them so we get 
compile time errors instead of garbage values in the shader.
2024-12-11 12:49:05 -08:00
Serge Metral 93790cd06c Android hardware buffer import in Vulkan (#8295)
- Platform changes for the extensions
- Platform changes for the processing of the AHB
2024-12-11 19:00:42 +00:00
Sungun Park 94c1657ca0 Release Filament 1.56.3 2024-12-11 02:17:39 +00:00
Mathias Agopian 776a748e05 fix a ResourceList<> "soft" leak when destroying a material
A ResourceList<> object was leaked when destroying a material until the 
Engine was shut down. This could however grow unbounded if churning 
through Materials.

What was actually leaked was entries in the hashmap linking a material
to its material instance list.

BUGS=[383158161]
2024-12-10 14:22:57 -08:00
Mathias Agopian 03fdadf417 Fix ARC objects leak in MetalShaderCompiler thread
When using async shader compilation, the compiler thread pool is a 
standard pthread and not an NSThread. Therefore, it needs a manual
@autorelease pool, otherwise ARC objects never get truly released. 

BUGS=[383167935]
2024-12-10 14:22:40 -08:00