The previous implementation allowed the backend thread to modify the
program state while it was still being cached on the compiler thread.
This could lead to potential data corruption or inconsistent cache
blobs.
To ensure data integrity, the program blob is now cached before the
signal is dispatched. This prevents the receiving thread from modifying
the program (e.g., via glUniformBlockBinding) until the caching process
is fully finalized.
BUGS=[491819760]
The previous eviction time is too large (40), then causes memory
to bloat over time. We set the default to 3 (as in triple
buffering), but make it a configurable option via VulkanPlatform.
Fixes#9786
- Update get-mesa.sh to query dpkg --print-architecture to install
the correct packages dynamically, enabling aarch64 support.
- Update get-vulkan-sdk.sh to install via apt-get on Linux
(libvulkan-dev, vulkan-validationlayers, glslang-tools,
spirv-tools) instead of downloading LunarG's x86_64 tarball.
- Add runner architecture to Mesa and Vulkan SDK GitHub Action cache
keys to prevent collision.
- Update test.sh and preamble.sh to detect aarch64 and point to
the appropriate aarch64-linux-gnu libraries.
- Fix typos and some renaming
Add the following information:
- Android build fingerprint, version
- GPU driver name, info, vendor name
- Time elapsed for test
- Rendered images (as oppose to diff image)
filament-utils:
- Add DeviceUtils to hook into Platform methods for reading out
strings about gpu vendor, driver.
Fix "tolerance" in test definition
For renderdiff, we compile mesa using brew's llvm/clang, but
we compile filament with the system clang (AppleClang).
This is to prevent compiling filament with brew's clang (which
can cause unexpected compilation error).
- Add reset functionality to ModelViewer
- We use this reset in render-validation to not have to reload
the scene in runs that use the same model.
- Fix a bug where the camera manipulator is disabling setting
the camera via view config.
Fixes a SIGSEGV crash that occurs during
`ExternalStreamManagerAndroid::release()` when users provide a custom
Platform instance during Engine creation.
When a custom Platform is used, ExternalStreamManagerAndroid is
instantiated on the application's thread. Its constructor was caching a
C++ reference (`VirtualMachineEnv& mVm`) to the `thread_local`
VirtualMachineEnv instance belonging to the application thread.
Later, when the Filament backend thread executed `release()`, it
accessed this cached reference. This caused the backend thread to
retrieve the `JNIEnv*` from the application thread's `thread_local`
instance, and subsequently call `env->DeleteGlobalRef()`. A thread must
use its own `JNIEnv` pointer, so using the application thread's pointer
from the backend thread resulted in a crash.
BUGS=[489814416]
- Simplify getting cmake, ninja for linux
- Move linux, web, webgpu builds to use arm (more cores for less)
- Android cannot be moved due to Android SDK not available on
arm linux yet.
- Add Arm Linux release artifacts
Fixes#8674
libfilament (including libutils and libmath) are 100% std::string
free.
std::string is pulled in the .so (on android) through libc++ for
exception handling, even if we're not using them. There is not much
we can do here, but at least, it's not because of us!
utils::ostream still references it but only as an inline function,
so if the inline is not called, std::string won't be pulled in.
It's also referenced from Path.cpp, but that's not included in
libfilament.
This made it nearly impossible to find the actual error. Now, we
output only the error from the compiler + the material name, variant
and shader stage all in one line.
The main thread invokes `getTimerQueryValue` synchronously, reading
`tq->state`. Meanwhile, the driver thread handles `createTimerQuery`
asynchronously and initializes `tq->state = std::make_shared<State>()`.
Eliminate this race by initializing the state in createTimerQueryS.
BUGS=[491522442]
- Move header check from postsubmit to presubmit
- Install third_party/getop if needed
- Modify check-headers test to use system getopt when it's available.
On certain linux, macOS environment, there is already a system
getopt. This often creates conflict when compiling filament.
Here we alias utils::getopt to either the system getopt (if
present) or third_party/getopt.
Fixes#7551
- Update python3 version to 3.12.13
- Use action/checkout instead of Bhacaz/checkout-files because action/checkout can
use the action/files of the current PR, where as checkout-files is checking out
a file on the main branch
- action/checkout seems to run in less than a minute, so acceptable performance
difference.
--------------------------------------------------------------------
Breakage is:
Traceback (most recent call last):
File "/usr/local/lib/python3.10/site-packages/jwt/algorithms.py", line 36, in <module>
from cryptography.exceptions import InvalidSignature, UnsupportedAlgorithm
ModuleNotFoundError: No module named 'cryptography'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/verify_release_notes.py", line 17, in <module>
from github import Github
File "/usr/local/lib/python3.10/site-packages/github/__init__.py", line 56, in <module>
from github.MainClass import Github, GithubIntegration
File "/usr/local/lib/python3.10/site-packages/github/MainClass.py", line 54, in <module>
import jwt
File "/usr/local/lib/python3.10/site-packages/jwt/__init__.py", line 1, in <module>
from .api_jwk import PyJWK, PyJWKSet
File "/usr/local/lib/python3.10/site-packages/jwt/api_jwk.py", line 8, in <module>
from .algorithms import get_default_algorithms, has_crypto, requires_cryptography
File "/usr/local/lib/python3.10/site-packages/jwt/algorithms.py", line 113, in <module>
from typing_extensions import Never
ModuleNotFoundError: No module named 'typing_extensions'
The previous conditional used
github.event.head_commit.verification.verified, which is not a
real field. Hence, the attempt to reduce presubmit runs did not
actually succeed. Here we replace it with a more correct
verification step.
We make two adjustments to make the presubmit workflows run less.
- Only run on commit merge when the commit is not "verified".
While not a 1-1 definition, "verified" commit typically implies
that the commit came from a PR merge (which requires that
presubmit passes). A commit could also be made by owners on
main directly, in which case, the commit would not be verified.
- Cancel any in progress presubmit runs are "overwritten" by an
update to the PR.
I recently added a new fuzz test for my Filament-based app, which creates a window and then rapidly issues changes such as toggling View features, changing the window size, and other operations that the users of my app can do.
It quickly found a crash when Bloom is enabled and the window dimensions get resized to weird aspect ratios on a large monitor. Eventually I narrowed it down to the Bloom buffer's width exceeding the Metal max texture dimension (on my machine, 16K). Applying this patch fixes the crash.
This is a speculative reduction of github runner costs by using
less costly machines. The usage time will be longer, but
hopefully the total cost will still be lower.
Note we disabled most of the large runners for postsubmit builds,
since we should have caught all breakages in presubmit.
The DebugShadowCasacade material was dependent on frameUniforms,
instead we use material parameters. We also pass all the informations
relative to cascades (it's not used yet, but will be in the future).
- In finish(), instead of block to wait for read pixels to finish,
we poll the state of the counter to ensure that all the readbacks
are complete. This allows us to complete the readpixel callbacks
by advancing webgpu's internal callback counter.
- Remove all the redundant flushes that are no longer needed now
that buffer upload is put on the command queue.
- Add a convenience method for getting swapchain dimensions. Will
be useful.
- Add webgpu as a valid backend for running backend tests on linux
(now that it no longer deadlocks).
- In finish(), instead of block to wait for read pixels to finish,
we poll the state of the counter to ensure that all the readbacks
are complete. This allows us to complete the readpixel callbacks
by advancing webgpu's internal callback counter.
- Remove all the redundant flushes that are no longer needed now
that buffer upload is put on the command queue.
- Add a convenience method for getting swapchain dimensions. Will
be useful.
- Add webgpu as a valid backend for running backend tests on linux
(now that it no longer deadlocks).
This commit addresses a critical security vulnerability (OOB write) and
several stability issues in the Radiance HDR parser.
Primary Fix:
* Fixed a heap buffer overflow in the RLE decoding loop (Issue #9748).
The decoder previously failed to verify if a run-length chunk exceeded
the remaining space in the scanline buffer. Added strict bounds checking
(`num_bytes + run_length > width`) before executing `memset` or
`mStream.read` to prevent arbitrary memory corruption.
Additional Security & Stability Improvements:
* Prevented an infinite loop (DoS) in header parsing. Replaced the
`do { ... } while(true);` loop with proper stream state checking
(`while (mStream.getline(...))`) to handle unexpected EOFs gracefully.
* Mitigated integer overflow and Out-Of-Memory (OOM) vulnerabilities by
enforcing maximum sane dimensions (`MAX_IMAGE_DIMENSION` and
`MAX_IMAGE_PIXELS`). This prevents catastrophic memory allocations
triggered by maliciously crafted width/height values.
* Initialized local variables and buffers (`buf`, `gamma`, `exposure`) to
prevent undefined behavior and parsing of stack garbage upon stream read
failures.
Fixes#9748
Keeping ShaderLanguage::UNSPECIFIED will return metal library
as the preferred language on metal. Here we just make it more
explicit that matdbg needs msl.
Fixes#9372
The toggle for animation was added recently to Settings and default
to false. This differs from before where animation is always assumed
to be enabled.
For gltf_viewer's interactive mode, we enable animation. (Batch mode
will still have animation off).
Fixes#9775
- Include gl_headers.h since it defines BACKEND_OPENGL_VERSION_GL(ES)
depending on which headers are available.
- Don't assume glGetString(GL_EXTENSIONS) returns a non-null value as
null is a possible return value for OpenGL (desktop).
We add the ability for the maniuplator to be null. If it is null,
then the camera settings won't be determined by the manipulator.
This is useful for when we want to set the camera parameters
outside of the modelviewer, but still use it to do everything else.
The init block of addPass will be executed immediately, which means
that even for passes that are culled, we will trip on incorrect format
given to the pass.
We move the stencil check to the execute block of addPass so that
it'll only assert when the pass is actually present in the graph.
FIXES=489437881
* engine: encapsulate material cache handling
We will soon allow `MaterialInstance` to override the value of spec constants.
To avoid code duplication, we introduce a new class `MaterialPrograms` which
handles the chunky bits of managing the program cache and values of the spec
constants.
* MaterialPrograms: add explicit initialize method
* MaterialPrograms: backport fixes, address comments
* MaterialPrograms: set all constants at once
* MaterialPrograms: rename to LocalProgramCache
* utils: add LRU cache to RefCountedMap
This change introduces a new data structure LruCache and uses it in
RefCountedMap to keep a fixed number of cache entries alive after their
reference count has dropped to zero in the main map.
* utils: address LRU cache comments