Commit Graph

8295 Commits

Author SHA1 Message Date
Powei Feng
d869223c82 render-val: add page generation for results 2026-04-28 23:07:30 -07: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
Mathias Agopian
a943b57c86 ktxreader: Fix vulnerabilities and memory leaks in Ktx2Reader.cpp
- Implement PR #9842 to fix integer overflows in transcodeImageLevel.
- Fix potential division by zero in transcodeImageLevel if bytesPerPix is 0.
- Fix memory leaks in transcodeImageLevel by freeing allocated buffers on
  failure.
- Fix memory leak in Ktx2Reader::load by deleting PixelBufferDescriptor after
  use.
2026-04-16 09:10:08 -07:00
Mathias Agopian
ffa2886493 gltfio: Fix security and memory corruption issues in Utility.cpp
- Fix potential division by zero in decodeMeshoptCompression when stride is 0.
- Fix ignored errors in release builds for meshopt decoding by returning bool
  and checking the result in ResourceLoader.cpp.
- Fix potential integer underflow in computeBindingSize when count is 0 by
  returning 0.
- Update ResourceLoader.cpp to skip buffer upload when computeBindingSize
  returns 0, preventing potential OOM or OOB reads.
2026-04-16 09:10:08 -07:00
Mathias Agopian
415ba57272 Correctly filter out ESSL1 variants
This fixes a recent breakage of the SSR variant while reducing the
size of featureLevel 0 materials.
2026-04-16 09:08:44 -07:00
Ben Doherty
d6369f1007 Bump macOS minimum supported version to 11.0 (#9902) 2026-04-15 16:17:25 -07:00
Filament Bot
0203291b6a [automated] Updating /docs due to commit e85c021
Full commit hash is e85c021dec

DOCS_ALLOW_DIRECT_EDITS
2026-04-15 16:45:49 +00:00
Mathias Agopian
e85c021dec remove the now unneeded FL0 materials
Filament needed to compile FL0 materials for both FL0 and FL1, but this
is now done automatically when a material is a FL0 material.
2026-04-15 09:20:26 -07:00
Mathias Agopian
eb3d592d18 expose EntityManager::getIndex() publicly
This can be needed for interactions with an outside entity system.
Use with caution.
2026-04-15 09:19:00 -07:00
Powei Feng
3b5776a232 vk: improve readpixels (#9883)
- Account for multi-sampling in readback
- Add more types for Conversion::getComponentType()
2026-04-14 05:28:00 +00:00
Filament Bot
afb0b39903 [automated] Updating /docs due to commit 562b66c
Full commit hash is 562b66c715

DOCS_ALLOW_DIRECT_EDITS
2026-04-14 04:46:10 +00:00
Powei Feng
54f3490414 Fix ssao precision issue around silhouettes
In the ssao pass, for silhouette pixels,

```
highp vec3 v = p - origin;
```

can be a "long" vector where the length cannot be captured with
mediump on mobile. This means that

```
float vv = dot(v, v);
float vn = dot(v, normal);
```
and other variables can overflow. This caused the silhouettes to
be dark when ssao is turned on a PowerVR gpu.

The fix is use highp for the relevant variables.
2026-04-13 21:43:48 -07:00
Kai
e0b2133333 Fix direct lighting computation 2026-04-13 21:43:13 -07:00
Kai
9887eab8c0 update clearcoat ibl doc 2026-04-13 21:43:13 -07:00
Sungun Park
562b66c715 doc: Clarify MSVC support for windows
See issue #9894 for more context
2026-04-13 21:18:25 -07:00
Mathias Agopian
8ec732dadc FL0 materials are always compile via spirv-cross 2026-04-13 20:53:35 -07:00
Filament Bot
62ac2950c9 [automated] Updating /docs due to commit defba15
Full commit hash is defba15173

DOCS_ALLOW_DIRECT_EDITS
2026-04-13 21:27:53 +00:00
StreetwareGames
defba15173 update the cached image too 2026-04-13 13:58:32 -07:00
StreetwareGames
4b4074450a fix milkyway image url 2026-04-13 13:58:32 -07:00
Mathias Agopian
84dc1b1c43 Add custom color grading LUT support and test UI in gltf_viewer.
Implemented the custom 3D LUT feature in the ColorGrading API, allowing
users to specify a custom LUT for final color mapping.

To test this feature, added a "Custom LUT" option to the color grading
settings in the gltf_viewer sample. This includes several procedurally
generated LUTs for testing purposes:
- Negative
- Grayscale
- Sepia
- Teal and Orange

Updated settings serialization (Settings.cpp) and the viewer UI
(ViewerGui.cpp) to support these options.

FIXES=[362596936]
2026-04-13 13:40:23 -07:00
Jocelin Cailloux
115c2cf8fe Add missing #include <cstring> and <optional> (#9887) 2026-04-10 18:54:05 +00:00
Powei Feng
5fed291284 3p: add models Fox and TransmissionRoughnessTest (#9889) 2026-04-10 05:10:33 +00:00
Powei Feng
7212317a3b android: [render-validation] UI update and enhanced tolerance definition (#9876)
- Update default_test.json with targeted test variants and documented
  tolerance presets.
- Refactor test suite to cover distinct code paths while maintaining
  multi-backend compatibility (OpenGL/Vulkan).
- Integrate TestProgressBar and UI summary text for better test progress
  visualization.
- Enhance validation managers with dynamic naming, zip extraction/export,
  and bundle creation.
- Update validation_app.py terminal UI to support multiple devices,
  device switching, and local result serving.
2026-04-09 15:39:20 -07:00
Ben Doherty
e8ae717c28 Fix null texture pointer crash in GLDescriptorSet (#9884) 2026-04-08 13:00:41 -07:00
Filament Bot
b6cb8096e6 [automated] Updating /docs due to commit be32398
Full commit hash is be3239810a

DOCS_ALLOW_DIRECT_EDITS
2026-04-08 02:09:32 +00:00
Benjamin Doherty
be3239810a Release Filament 1.71.0 rc/1.71.1-cut 2026-04-07 18:41:31 -07:00
Mathias Agopian
e8b268bce4 replace AutoresolveDifferingSampleCounts test
It's not clear what this test was trying to test and its golden was
wrong. 

Removed this test, and replaced it with a simple "autoresolve" test.
2026-04-03 17:02:18 -07:00
Mathias Agopian
88ef82a611 [backend/test] Fix MSAA resolves of depth/stencil attachments
- the first problem was that we don't need (or can) resolve RenderBuffer
  attachments, it's meaningless.

- the bigger problem was that we were marking all attachments of a FBO
  for potential resolve (at FBO creation).  Later, during endRenderPass, 
  the resolve pass itself would be triggered if the RT had a sidecar
  RT. But that's wrong because attachments that match the RT sample
  count don't need to be resolved.
  In turn, this was causing these attachments to be *discarded* 
  because, in beginRenderPass, we were detecting a case where it 
  looked like a MS attachment was used with non a MS rendertarget
  (and filament disallows that, the attachment must be discarded).
  We fix this by making sure attachments that don't need to be
  resolved are not marked as such.


FIXES=[453757787]
2026-04-03 17:02:18 -07:00
Mathias Agopian
b4256c1c15 [backend/test] Fix LoadImageTest.UpdateImageSRGB precision mismatch on OpenGL
Relaxes exact pixel matching for `UpdateImageSRGB` test on software/MESA OpenGL drivers. Linear filtering on sRGB textures produces slightly different fractional weights for edge pixels compared to hardware texturing units.

FIXES=[453756688]
2026-04-03 17:02:18 -07:00
Mathias Agopian
b49b61e131 [backend/test] Fix BlitTest scaling failures on MESA OpenGL
Relaxes exact pixel matching for `ColorMagnify` and `ColorMinify` tests on software/MESA OpenGL drivers. Software blit interpolation (glBlitFramebuffer) produces slightly different fractional weights for edge pixels compared to discrete hardware texturing units. 

FIXES=[453757697, 453758045, 453776623]
2026-04-03 17:02:18 -07:00
Mathias Agopian
92dc063a8a filaflat: Fix missing bounds checks in MaterialChunk::getTextShader (#9873)
- Added a bounds check in the DICTIONARY_NUMERIC_FLAG case to prevent a 
  heap buffer overflow when writing decoded numeric literals.

- Tightened the existing bounds check for dictionary strings to use `>=`
  instead of `>`, preventing a potential off-by-one overflow when 
  writing the null terminator.

- Fixed the `MaterialChunkHeapOverflow` and `MaterialChunkOOBReadText` 
  unit tests in `test_filaflat.cpp` by adding missing header fields to 
  the mock payloads so they correctly pass initialization.

Fixes #9871
2026-04-03 16:02:56 -07:00
Powei Feng
e8fe85ee89 filamat: make DryRunner in Flattener not static (#9872)
This enables multiple thread to use MaterialBuilder/Flattener at
the cost of allocating, deallocating a flattener.
2026-04-03 18:41:50 +00:00
Doris Wu
0b63969aab Make the LruCache size of material/program cache configurable (#9865) 2026-04-03 03:10:14 +00:00
dependabot[bot]
af71d773ae build(deps): bump the npm_and_yarn group across 1 directory with 2 updates (#9870)
Bumps the npm_and_yarn group with 2 updates in the /build/common/upload-release-assets directory: [brace-expansion](https://github.com/juliangruber/brace-expansion) and [minimatch](https://github.com/isaacs/minimatch).


Updates `brace-expansion` from 1.1.12 to 1.1.13
- [Release notes](https://github.com/juliangruber/brace-expansion/releases)
- [Commits](https://github.com/juliangruber/brace-expansion/compare/v1.1.12...v1.1.13)

Updates `minimatch` from 3.1.3 to 3.1.5
- [Changelog](https://github.com/isaacs/minimatch/blob/main/changelog.md)
- [Commits](https://github.com/isaacs/minimatch/compare/v3.1.3...v3.1.5)

---
updated-dependencies:
- dependency-name: brace-expansion
  dependency-version: 1.1.13
  dependency-type: indirect
  dependency-group: npm_and_yarn
- dependency-name: minimatch
  dependency-version: 3.1.5
  dependency-type: indirect
  dependency-group: npm_and_yarn
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Powei Feng <powei@google.com>
2026-04-02 17:06:54 +00:00
Mathias Agopian
57faae4645 postfx materials now support sRGB emulation in FL0 (#9866)
FIXES=[498317018]
2026-04-02 09:08:50 -07:00
Filament Bot
e6cf5fa815 [automated] Updating /docs due to commit 426db0a
Full commit hash is 426db0a01d

DOCS_ALLOW_DIRECT_EDITS
2026-04-02 03:37:21 +00:00
Sungun Park
426db0a01d Release Filament 1.70.2 rc/1.71.0-cut 2026-04-01 20:08:07 -07:00
Mathias Agopian
bc0a547701 Support Engine::compile overload to generate view-dependent variants (#9857)
* a new tribool type in libutils (header only)

* Support `Engine::compile` overload to generate view-dependent variants

Implemented an `Engine::compile()` method to infer and generate shader 
permutations directly based on feature states from a provided `View` 
alongside `tribool` settings (skinning, shadowReceiver). 

- Added a new `Material::compile()` overload that directly accepts 
  a precalculated `FixedCapacityVector<Variant>`, decoupling the 
  Material compilation process from specific feature flag checks.

FIXES=[468058969]
2026-04-01 17:08:11 -07:00
Powei Feng
dd1f258a66 settings: add missing renderer options (#9863)
- Move the renderer options to be applied before others before view
   and camera options.
 - Add "render" field to the output of the json description of
   the settings (this was missing).
 - This fixes the Scene->Background Color setting for
   Android's gltf_viewer
2026-04-02 00:04:22 +00:00