Commit Graph

8332 Commits

Author SHA1 Message Date
Filament Bot
35d7b819e1 [automated] Updating /docs due to commit 9b2959d
Full commit hash is 9b2959d3a4

DOCS_ALLOW_DIRECT_EDITS
2026-04-30 18:30:04 +00:00
Powei Feng
9b2959d3a4 web: fix redball and fl0 examples (#9942)
- Remove conditional forgotten by #9897
   Fixes cube_fl0 example
 - Add byte array view methods that are no longer exported by
   default in emscripten 5.0.4 (#9921)
   Fixes redball tutorial
2026-04-30 17:58:16 +00:00
Èric Bitriá Ribes
7309a05ac3 feat: iOS simulator (arm64) support (#9893) 2026-04-29 16:20:11 -07:00
Filament Bot
2132e5cda5 [automated] Updating /docs due to commit 96b8015
Full commit hash is 96b8015fb4

DOCS_ALLOW_DIRECT_EDITS
2026-04-29 22:46:17 +00:00
Powei Feng
96b8015fb4 web: rename WEBGL to WASM for cmake (#9941)
This is a more accurate name because it specifies the platform and
not the graphics API.
2026-04-29 22:21:25 +00:00
Mathias Agopian
9c27bfa3e1 utils: Improve StructureOfArrays (#9936)
- Added `copyRange()` to `StructureOfArrays` to efficiently copy a range
  of elements from another SoA of the same type. It uses `std::copy_n`
  which leverages `memcpy` for trivially copyable types.
- Added `operator[]` to `StructureOfArrays` returning `IteratorValueRef`.
- Added `operator=` for `Structure` (tuple) to `IteratorValueRef` to
  allow direct assignment: `soa[i] = tuple`.
- Added unit tests for these new methods in `test_StructureOfArrays.cpp`.
2026-04-29 09:06:26 -07:00
Filament Bot
25a12b47c9 [automated] Updating /docs due to commit c481025
Full commit hash is c48102504e

DOCS_ALLOW_DIRECT_EDITS
2026-04-29 06:44:13 +00:00
Powei Feng
052e95eb2f mesa: update mesa version and ensure linux build (#9938)
- Update mesa version to 25.0.3 so that it builds with clang-17.
 - Make sure that abseil checks do not block compilation (this
   was due to unknown incompatiblity that appeared when trying to
   build abseil on linux and clang-17).
2026-04-29 04:36:54 +00:00
Sungun Park
c48102504e Release Filament 1.71.2 rc/1.71.3-cut 2026-04-28 21:07:12 -07:00
Ben Doherty
d12be26b13 Implement shared contexts for Mesa platform (#9937) 2026-04-28 11:46:28 -06:00
Ben Doherty
3aa129240e Metal: implement asynchronous resource loading (#9930) 2026-04-27 14:18:07 -06:00
Mathias Agopian
3f58c3b57d Implement batch callback system for scene cache incremental updates. (#9935)
* Implement batch callback system for scene cache incremental updates.

This change adds a batch callback mechanism to track changes in component
managers and the entity manager, avoiding full cache rebuilds in the
future scene cache implementation.

1. SingleInstanceComponentManager:
- Added SingleInstanceComponentManagerBase to handle callbacks without
  template bloat.
- Implemented batch delivery using Slice<const Entity> and a fixed-size
  array of 16 for dirty entities to avoid heap allocations.
- Added compile-time option for sorted insertion (default to linear).

2. Manager Integration:
- RenderableManager: Added notifications to setters.
- LightManager: Added notifications to setters
- TransformManager: Handled transactions by deferring notifications
  until commit, and supported hierarchical updates in children.

3. EntityManager:
- Added a new batching callback API for entity destruction.
- Used std::function for callbacks to allow thread-safe copying of the
  callback list outside the lock.
- Simple accumulation in loop and flush when full, no bypass.

4. Tests:
- Added formal unit tests for all managers and entity manager callbacks.
2026-04-24 17:07:44 -07:00
Filament Bot
40aab3896c [automated] Updating /docs due to commit f7fd6a9
Full commit hash is f7fd6a9eab

DOCS_ALLOW_DIRECT_EDITS
2026-04-23 21:48:45 +00:00
Powei Feng
65f7939513 renderdiff: fix python < 3.10 compatibility in update_golden.py
RDIFF_ACCEPT_NEW_GOLDENS
2026-04-23 14:37:16 -07:00
Mathias Agopian
f7fd6a9eab Implement grid-based world origin snapping in View (#9917)
* Implement grid-based world origin snapping in View

Implement a grid-based world origin snapping system in View to avoid
per-frame transform updates in the future. This will allow to
improve CPU performance and to enable future caching of acceleration
structures like BVH.

The feature is protected by the 'view.enable_grid_based_world_origin'
feature flag. The grid size can be set
manually via View::setGridSize or calculated automatically as 10%
of the camera's far plane distance.

A 50% hysteresis ratio is applied to prevent rapid origin flipping
near grid edges.

Exposed the new API to Java and JavaScript bindings and added
unit tests in filament_test.cpp.

BUGS=[504726278]

* Refine grid-based world origin snapping implementation

Refine the grid-based world origin snapping in View with several
improvements:

1. Support Orthographic Projections:
   Calculate automatic grid size using projection matrix elements,
   working for both perspective and ortho without assuming positive
   near plane.

2. Stable Automatic Grid Size:
   Only update effective grid size when a position snap occurs.
   This prevents instability when frustum scale changes smoothly.

3. Immediate Manual Override:
   Force an immediate snap when user manually changes grid size.

Added test cases for ortho and auto-grid size in filament_test.cpp.
2026-04-23 14:19:44 -07:00
Romain Guy
004b410f41 Fix macOS build with clang 21 (#9928) 2026-04-23 14:00:04 -07:00
Powei Feng
10702e2d07 webgpu: implement push constants with immediates (#9932)
- Add test for skinning for gl, vk, and webgpu

RDIFF_ACCEPT_NEW_GOLDENS
2026-04-23 20:22:08 +00:00
Powei Feng
e45e9c40fe github: display original commit title for status workflows
GitHub Actions displays the workflow name instead of the commit title
when a workflow is triggered by `workflow_run`. This makes it difficult
to identify the commit associated with a status workflow run in the UI.

Added the `run-name` attribute to all `status-*.yml` files, dynamically
setting it to the `display_title` of the original workflow run. This
restores visibility of the commit message or PR title in the Actions UI.
2026-04-23 12:43:48 -07:00
Filament Bot
d00691c727 [automated] Updating /docs due to commit d16ebaa
Full commit hash is d16ebaa94f

DOCS_ALLOW_DIRECT_EDITS
2026-04-23 18:45:37 +00:00
Powei Feng
d16ebaa94f github: restore platform-specific status badges in README (#9931)
Consolidating the CI workflows into a single postsubmit.yml broke the
individual platform status badges in the README, as GitHub Actions
only supports status badges at the workflow level, not the job level.

Added shadow workflows (e.g., status-android.yml) that trigger on
the completion of the main "Postsubmit CI" workflow. These scripts
query the GitHub Actions API to determine the success or failure of
their respective job (e.g., build-android) and reflect that status.
Updated the README to point to these new workflow badges.
2026-04-23 18:17:28 +00:00
Filament Bot
7a1f155d71 [automated] Updating /docs due to commit f9e56a1
Full commit hash is f9e56a11d1

DOCS_ALLOW_DIRECT_EDITS
2026-04-23 17:20:43 +00:00
Mathias Agopian
f9e56a11d1 feat: Make C++ exceptions and RTTI configurable (#9913)
Introduced the FILAMENT_ENABLE_EXCEPTIONS (default ON) and
FILAMENT_ENABLE_RTTI (default OFF) CMake options to control these
features globally. This replaces previous hardcoded, platform-specific
overrides.

Added a -E flag to build.sh to easily disable exceptions during
build configuration.

Removed hardcoded -fno-exceptions and -fno-rtti from
android/build.gradle to allow CMake to control these flags, but kept
-fno-rtti enabled by default for the Java/Android build as requested.

Documented in CMakeLists.txt and BUILDING.md that the JNI library
(Android/Java build) requires exceptions to be enabled.

Enabled RTTI specifically for the assimp target in
third_party/libassimp/tnt/CMakeLists.txt to fix compilation errors
caused by its use of dynamic_cast.

SIZEGUARD_BYPASS
2026-04-23 09:52:26 -07:00
Doris Wu
fd2684513e Fix some issues for MaterialCache (#9922)
Updated MaterialKey comparison to check values instead of pointers
Defer the termination of MaterialCache until after mMaterials is cleaned up to avoid a double-free issue
BUGS=[499843464]
2026-04-23 09:49:59 -07:00
Powei Feng
3734dc1930 fgviewer: do not assume fgviewer is present in framegraph (#9924)
Even with FILAMENT_ENABLE_FGVIEWER defined, we cannot assume
that fgviewer has been set. For example, fgviewer can be null when
we enable the define for tests, but fgviewer did not initialize
due to the server port being undefined.
2026-04-23 09:48:21 -07:00
Powei Feng
bbc3ddea33 webgpu: update dawn to chromium/7792 (#9916)
Includes the following updates to Filament and Dawn to support the new version:
- CMake Configuration: Enabled OBJC/OBJCXX and set C++ standard to 20 for
  Apple targets to support Dawn's Metal backend.
- WebGPU Backend API: Replaced `wgpu::ShaderModuleWGSLDescriptor` with
  `wgpu::ShaderSourceWGSL`, updated compilation info callbacks to use
  `wgpu::CompilationInfoRequestStatus`, and removed deprecated
  `wgpu::TextureFormat::External`.
- Tint Integration (`GLSLPostProcessor.cpp`): Migrated to `ReadIR` and
  `WgslFromIR`. Enabled `allow_non_uniform_derivatives` and
  `disable_unreachable_code_warning` to bypass strict uniformity analysis on
  UBOs, and allowlisted `gl_ClipDistance` for stereoscopic materials.
- Dawn Patches: Manually re-applied and updated
  `remove-vk-macos-restriction.patch` to account for upstream refactoring in
  `BackendVk.cpp`.
- AppleClang 17 RTTI Workaround: Added
  `tint-texture-gather-unwrap-pointer.patch` to conditionally bypass an
  AppleClang 17 optimizer bug causing RTTI dynamic cast failures in Tint
  (`TINT_ASSERT(tex_ty)`).
  Turns out this workaround is necessary for linux clang as well.
2026-04-22 22:24:25 +00:00
Jorge Garcia Galicia
6d5f1cf691 Stencil support for VK backend (#9888)
In order to support stencil op in VK we need to:

1)Configure corresponding pipeline/render pass
2)Configure attachment/FB

Previous PR (#9716) covers 1)
This PR covers 2)

This PR also makes the the following tests pass on VK

BasicStencilBufferTest.StencilBuffer
BasicStencilBufferTest.DepthAndStencilBuffer
2026-04-22 13:40:55 -07:00
Filament Bot
594d36423a [automated] Updating /docs due to commit f4a079f
Full commit hash is f4a079f663

DOCS_ALLOW_DIRECT_EDITS
2026-04-22 18:21:46 +00:00
Mathias Agopian
f4a079f663 backend: Propagate backend thread exceptions to the main thread. (#9903)
* Filament Error Handling Remediation and noexcept Cleanup

- Replaced assert_invariant with FILAMENT_CHECK_PRECONDITION in
  Renderer::beginFrame for caller bugs.
- Removed noexcept from Camera::setCustomProjection to allow precondition
  checks to throw.
- Removed noexcept from Texture and InstanceBuffer methods using precondition
  checks.
- Documented silent clamping in View::setBloomOptions.
- Clarified comment in FrameGraphResources regarding preconditions.
- Refined MaterialInstance::commit to split texture loop into check and update
  passes, preventing partial state changes on precondition failure.

* backend: Propagate backend thread exceptions to the main thread.

Introduce a mechanism to catch exceptions thrown on the backend thread and
rethrow them on the main thread. This prevents deadlocks and allows the
application to handle fatal backend failures gracefully.

- Consolidate synchronization primitives in DriverBase.
- Add mHasUnrecoverableError flag to interrupt blocked fence waits.
- Optimize waitForFence to avoid extra atomic reads in common paths.
- Propagate FenceStatus::ERROR across all backends.
- CommandBufferQueue now stores a std::exception_ptr when the backend fails.
- The backend enters a "zombie" state on failure, skipping further command
  execution but allowing clean shutdown.
- Public APIs in Renderer and Engine now check for stored exceptions and
  rethrow them, documented with @throws.
- Guarded by __EXCEPTIONS to ensure no overhead when exceptions are disabled.
- Add unit test for fence interruption and document new APIs.

BUGS=[407545700]

* feat: harden backend exceptions and add hasUnrecoverableFailure API

- Update Renderer::beginFrame() and Renderer::shouldRenderFrame() to
  return false early if an unrecoverable backend exception has been
  delivered to the main thread.
- Document the new return behavior for beginFrame() and
  shouldRenderFrame() in Renderer.h.
- Add Engine::hasUnrecoverableFailure() to the public API to allow
  apps to check for fatal errors without relying on exceptions.
- Implement hasUnrecoverableFailure() in FEngine by delegating to
  CommandBufferQueue.
- Expose Engine::hasUnrecoverableFailure() to Java bindings
  (Engine.java and JNI).
- Expose Engine::hasUnrecoverableFailure() to JavaScript bindings
  (jsbindings.cpp).

* java: propagate C++ Panics & exceptions to JAVA
2026-04-22 10:56:09 -07:00
Ben Doherty
fa987f225d Add missing output precision to custom surface output (#9923) 2026-04-22 13:21:10 -04:00
Filament Bot
c63c8e1741 [automated] Updating /docs due to commit 05dde7e
Full commit hash is 05dde7e2cf

DOCS_ALLOW_DIRECT_EDITS
2026-04-22 16:45:54 +00:00
Powei Feng
05dde7e2cf Update emsdk to 5.0.4 (#9921)
- Bumped GITHUB_EMSDK_VERSION to 5.0.4 in build scripts and docs.
- Fixed a compilation error in web/filament-js/jsbindings.cpp where stricter
  pointer binding rules in Emscripten 5.0.4 caused a build failure when
  returning a raw pointer wrapped in `emscripten::val`. Changed the lambda
  to return the raw pointer directly, leveraging Embind's `allow_raw_pointers()`.
2026-04-22 09:18:24 -07:00
Filament Bot
dea71a278c [automated] Updating /docs due to commit b6a7226
Full commit hash is b6a7226213

DOCS_ALLOW_DIRECT_EDITS
2026-04-22 00:10:17 +00:00
Powei Feng
b6a7226213 Bump clang dep version from 16 to 17 (#9919)
The latest version of third_party/dawn requires clang 17.
2026-04-21 23:40:55 +00:00
Powei Feng
2ae4dc4c62 fgviewer: visualize intermediate buffers (#9862)
* Intermediate Buffer Visualization: Enabled live monitoring of internal
  `FrameGraph` render targets directly in the `fgviewer` web UI.
* HTTP Polling Architecture: Switched from WebSocket binary pushes to native
  `<img>` polling (`/api/image`)
* Robust Resource Tracking: Replaced string-based lookups with
  `(ViewId, ResourceId)` composite keys to prevent cross-view collisions and
  ensure accurate reads.
* Format Post-Processing: Extracted readback conversions (HDR tonemapping,
  depth normalization, MSAA downsampling, single-channel expansion) into
  `DebugServer`.
* UI Polish: Added a live-updating full-screen image modal and explicitly
  filtered internal debug passes from the Graphviz/JSON exports to prevent
  DOM thrashing.
* WIP: Currently Unsupported:
  * GL backend: failed with:
      OpenGL framebuffer error 0x8cd6 (GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT) in "readTexture" at line 4198
  * Mipmaps & Subresources: Reading specific mip levels or array layers is
    explicitly skipped.
  * Shadowmaps: Variance Shadow Maps (VSM) will physically evaluate to `0.0`
    and appear completely empty/black in scenes without active shadow
    casters (due to inverted-Z).
  * Stencil: Resolving and reading stencil buffer data is not supported by
    the backend.
* WIP: Untested outside of MacOS+metal/vk
2026-04-21 20:30:45 +00:00
Filament Bot
d3475e6dff [automated] Updating /docs due to commit f82085f
Full commit hash is f82085f676

DOCS_ALLOW_DIRECT_EDITS
2026-04-21 19:47:05 +00:00
Powei Feng
f82085f676 Release Filament 1.71.1 rc/1.71.2-cut 2026-04-21 12:19:43 -07:00
Filament Bot
695c2f82ea [automated] Updating /docs due to commit c55ee9f
Full commit hash is c55ee9faae

DOCS_ALLOW_DIRECT_EDITS
2026-04-21 18:25:14 +00:00
Powei Feng
c55ee9faae sizeguard: add tag to bypass test (#9743) 2026-04-21 17:58:05 +00:00
Powei Feng
2a561211aa ppm: compile resolveDepth only for vk/metal (#9904)
Sampling from a multi-sampled texture is not allowed for webgpu.
From the comments in the material, we only need this for vk and
metal.
2026-04-20 18:36:25 +00:00
Ben Doherty
533294de9a Add support for custom outputs for unlit surface materials (#9912) 2026-04-20 11:46:21 -04:00
Ben Doherty
4787e341d6 Add feature level when outputting raw shaders (#9911) 2026-04-17 13:32:45 -04:00
Powei Feng
afeae22423 android: [render-validation] collection of adjustments (#9898)
- A triangle tracker under the progress bar to track the test
   currently in view within the scroll view.
 - Text label to indicate the current device under test when a
   test is running.
 -  add filter intent arg
 - Add Fox (animation, skinning) and TransmissionRoughnessTest
   (transmission) to the test.
 - Add applyAnimation to the ValidationRunner
 - Make camera zoom in for default test and adjust tolerance
   acoordingly
 - Fix non-determinism of SSR by
     - waiting for more frames
     - account for false returned from beginFrame
     - Clear frame history on new test entry
 - Include Build.HARDWARE information into result
 - Make results array more thread-safe
 - Remove unused paths
 - Adjust tolerance for two tests
2026-04-16 19:28:48 +00:00
Mathias Agopian
a2547731c0 Backend: Centralize fence synchronization and fix potential data races. (#9899)
* Backend: Centralize fence synchronization and fix potential data races.

Transitioned fence synchronization from per-fence condition variables to a
centralized shared condition variable in DriverBase, enabling future global
error propagation and interruption.

Encapsulated synchronization by hiding the mutex and condition
variable within DriverBase and exposing `waitForFence` and `signalFence`.

Fixed a critical bug in Metal backend where spurious wakeups would reset the
relative timeout duration, potentially leading to much longer waits than
intended. Resolved by using absolute time points (wait_until).

Fixed potential data races in Metal, OpenGL, and WebGPU backends by ensuring
that shared state (status or state pointers) is always accessed under the
protection of the mutex, specifically by capturing it inside the predicate.

Simplified Vulkan and WebGPU fences to be purely passive data holders.

Trade-off: Spurious wakeups are increased due to the shared condition variable,
but are handled correctly by mandatory predicates in all backends.

* Update filament/backend/src/metal/MetalHandles.mm

Co-authored-by: Ben Doherty <bendoherty@google.com>

* Update filament/backend/src/metal/MetalHandles.mm

Co-authored-by: Ben Doherty <bendoherty@google.com>

---------

Co-authored-by: Ben Doherty <bendoherty@google.com>
2026-04-16 11:30:41 -07:00
Ben Doherty
bfbb651ecd Metal: fix potential crash in when dynamic offsets are empty (#9908) 2026-04-16 14:05:10 -04:00
Anish Goyal
c041970c76 Make VulkanProgram a ThreadSafeResource (#9788)
With the introduction of cache prewarming, handles for vulkan programs
will be managed on a separate thread in the backend along with the main
backend thread. This requires an atomic refcount to ensure accuracy and
prevent race conditions.
2026-04-16 17:15:53 +00:00
Mathias Agopian
3a78c78e7c gltfio: Continue if floatsCount is 0 in ResourceLoader.cpp
Address feedback from PR #9896 to avoid zero-sized allocations and potential
out-of-bounds reads.
2026-04-16 09:10:08 -07:00
Mathias Agopian
8bfdc60d68 imageio: Fix vulnerabilities in PSDDecoder from PR #9881
- PSDDecoder: Add dimension limits (max 30,000) to prevent integer
  overflows during LinearImage allocation.
- Add checks for stream failure during pixel decoding to handle truncated
  files safely.
- Follow existing pattern in this file by using std::runtime_error for
  these checks, which are caught and handled by resetting the stream and
  returning an empty image.
- Add comment that LinearImage allocation cannot overflow with the new
  limits.
2026-04-16 09:10:08 -07:00
Mathias Agopian
f8f2280ee3 filaflat, image: Fix vulnerabilities from PR #9879 without aborts
- MaterialChunk: Return false in getTextShader when shaderSize is 0 to
  prevent out-of-bounds write of null terminator.
- Ktx1Bundle: In 3-argument constructor, check if total blobs calculation
  overflows uint32_t.
- Instead of aborting with FILAMENT_CHECK_POSTCONDITION, log a warning and
  set the object to a safe empty state (dimensions set to 0).
2026-04-16 09:10:08 -07:00
Mathias Agopian
e6e7c0325e uberz: Fix vulnerabilities in convertOffsetsToPointers without aborts
- Implement fixes inspired by PR #9853 to make convertOffsetsToPointers
  size-aware and prevent OOB reads and writes.
- Change function signature to return bool instead of void, allowing graceful
  error propagation instead of runtime aborts.
- Replace FILAMENT_CHECK_PRECONDITION with explicit checks that log errors
  and return false.
- Update ArchiveCache in gltfio and main in tools/uberz to handle failure.
- Add unit tests to verify rejection of invalid offsets.
2026-04-16 09:10:08 -07:00
Mathias Agopian
8d16ad8882 gltfio: Fix vulnerabilities in ResourceLoader.cpp
- Implement PR #9878 to add bounds checking in normalizeSkinningWeights,
  preventing heap OOB write by clamping the count to available buffer size.
- Fix 3 similar vulnerabilities in uploadBuffers where accessor->count was
  trusted for malloc allocation before cgltf_accessor_unpack_floats.
- Add overflow checks for allocation sizes in uploadBuffers.
- Clamp accessor count based on available buffer bytes in uploadBuffers to
  prevent OOB read.
2026-04-16 09:10:08 -07:00