- 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
- 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`.
- 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).
* 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.
* 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.
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.
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.
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
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]
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.
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.
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
* 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
- 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()`.
* 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
- 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
* 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>
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.
- 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.
- 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).
- 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.
- 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.