- Add code for handling empty/null constant name
- Use glUniform1ui() instead of glUniform1i() to workaround
crash on macbook pro (m4).
- Fully specify the constant name in the test (e.g.
`pushConstantsF.red` instead of `red`).
- Make sure that the uniform names are different between
vertex and fragment in the test. This is due to different
constant structs being defined between the two stages.
FIXES=453757504
Prevents hitching for most pipelines, on certain devices with Turnip-based drivers
This does not address external samplers yet. This simply handles the
case where we want to prewarm a pipeline with the base configuration.
Refactor program's descriptor set layout bindings, clean up some leaking
resources
This commit introduces a significant rework of the Temporal Anti-Aliasing (TAA) system, focusing on improving reconstruction quality, robustness, and introducing flexible upscaling.
Core TAA Algorithm improvements:
- Replaced the Catmull-Rom filter with a more efficient 5-tap Lanczos filter for history sampling, which includes deringing to reduce artifacts.
- The input color buffer is now properly "unjittered" using a Lanczos reconstruction filter.
- Improved the history rejection algorithm by skipping the expensive accurate clipping when the history sample is already within the neighborhood's color gamut.
- Added a new `hdr` option to properly handle HDR content by tonemapping colors before blending and untonemapping the result.
- Removed the ineffective `VARIANCE` only history rejection method.
- Added protection against negative numbers in `sqrt()` for increased stability.
TAA Upscaling:
- Replaced the boolean `upscaling` flag with a float factor, allowing for variable upscaling ratios (e.g., 1.5x, 2x).
- Upscaling now correctly adjusts viewport and projection settings.
- The TAA shader now receives viewport and resolution information to correctly handle upscaled rendering.
API and Configuration Changes:
- Deprecated the `filterWidth` TAA option as it no longer has an effect.
- Introduced the `upscaling` float property to `TemporalAntiAliasingOptions`.
- Added the `hdr` boolean property to `TemporalAntiAliasingOptions`.
Other Changes:
- Updated UI elements in the viewer and material sandbox to reflect the new TAA options.
- Updated Javascript bindings and TypeScript definitions for the new TAA settings.
- Refactored shader code for clarity and performance.
makeCurrent is not meant to acquire the swapchain; we should
do so at the momemnt we need it, to shorten the amount of time
a swapchain image/buffer needs to be held.
Since the struct refers to descriptors as opposed to specifically
bindings (although they do contain binding information as well), this
name is more appropriate.
- spectral reconstructions with 4 samples
- unroll the whole dispersion computation to improve performance
(batch texture fetches and reuse common values)
- tool to generate the matrices for spectral integration
This commit simplifies and unifies the FrameGraph's `addPass` API.
Key changes:
- The `addPass` method now uses a single, more flexible implementation
that handles different lambda signatures for both the setup and
execute stages.
- The execute lambda can now optionally omit the `DriverApi&` parameter,
reducing boilerplate for simple passes.
- The `addTrivialSideEffectPass` helper has been removed.
Side-effect-only passes can now be created directly with `addPass`
- Add support for vector parameters (float2, float3, float4) in the
parameters file using `{x, y, z}` syntax.
- Allow comments (`#`, `//`) and empty lines in the parameters file.
- Make the end value optional in the parameters file
(defaults to start value).
- Add `--size` / `-S` option to specify viewport dimensions.
- Optimize rendering by pre-filtering active material parameters.
- Remove hardcoded default parameters and silently ignore missing
parameters to support shared configuration files.
- Add documentation for the parameters file format.
- Split the function so that the 3-components loop is more apparent.
- Factored out the parts of the computation that don't depend on the
index of refraction, so they're only computed once.
- Moved the lod-from-roughness computation out of the loop as well.
It does depend on the IOR, but so little that it's not worth it.
The most important result of this change is that the code is now in
good shape if we wanted to change the implementation of dispersion for
these cases (for e.g.) :
- do the computation in the XYZ space
- use more than 3 wavelengths samples
- or use a stochastic approach, trading banding for noise
RDIFF_BRANCH=ma/better-dispersion
* Update createPipeline to have pipeline key input
Right now, createPipeline in VulkanPipelineCache assumes that you are
building a pipeline using mPipelineRequirements as the key, and that it
should be stored in the cache. In the case of the pipeline prewarming
change, this is not going to be the case; sometimes, the pipeline will
be stored in the cache, and sometimes it will be deleted immediately.
Also, the prewarmed pipelines will be created using separately defined
keys.
* Add knobs for enabling / disabling prewarm
* Add thread pool to VulkanPipelineCache
* Fix dynamic rendering enablement check
Query device features to ensure it is supported / we don't just have the
extension. Also, proactively enable dynamic rendering when creating the
device.
Currently only uniform buffers benefit from the bypass,
but this can also be extended to others buffers too.
This also help trying to match the performance of the
GL backend in Android.
FIXES=[470138463]
Co-authored-by: Serge Metral <sergemetral@google.com>
Api level is now enforced when generating code by appending #defines of client requested and unstable apis.
This ensures that the client can only use unstable apis when they explicitly add `apiLevel` in their .mat file.
FIXES=468340631
* rename ResourceAllocator to TextureCache
This better represents what this class is for.
* Make FrameGraph resource management extensible
This refactors the FrameGraph's resource management to allow for
user-defined custom resources.
A new `ResourceAllocator` template abstracts the creation and
destruction of resources, with specializations for different resource
types (e.g., generic, backend-dependent, textures).
This removes hardcoded resource management logic from the `FrameGraph`
execution loop.
A `ResourceCreationContext` is introduced to provide the necessary
context for resource allocation.
Tests for generic and backend custom resources have been added to
validate the new system.
* Update filament/src/fg/FrameGraphDummyLink.h
Co-authored-by: Powei Feng <powei@google.com>
---------
Co-authored-by: Powei Feng <powei@google.com>
This commit introduces async methods and functions across both the
public and backend APIs, enabling non-blocking creation and updates for
Texture, VertexBuffer, and IndexBuffer resources.
Asynchronous resource management is disabled by default. Users should
enable this to use the feature.
Java bindings and a C++ code sample will follow in subsequent PRs.
BUGS=[442921995]
- add a flag to run the sample using regular, non-external
texture as render target.
- Add a non-external version of the material
- vk: fix y-flipping issue with uvToRenderTargetUV()
The main goal of this CL is to break the dependency of RenderPassBuilder
on DriverApi. The dependency only existed for the auto-instancing
feature, which needed to allocate and update a UBO on the fly.
We want to break that dependency so that RenderPassBuilder::build().
which is an expensive call, could run on a separate thread. In the
future this could allow, for example, shadow and ssao passes to
run in parallel.
A new method RenderPass::finalize(DriverApi&) is added which *must* be
called before calling getExecutor(), this is where the temporary
UBO is allocated and updated. We need a new method because this must be
called on the main thread before a render pass is started.
This implementation stores the UBO data needed for instancing until
finalize() is called, if any.
We introduce a compact() utility that efficiently scans a range finding
"equivalent" consecutive objects and removes duplicates. The previous
code did that with an extra remove pass which invalidated all
iterators.
* VK: Refactor platform Vulkan initialization
Refactor the platform code to allow overriding
how the vkInstance, vkPhysicalDevice and vkDevice
are created.
This refactor will also consolidate where the extensions
and features are enabled/disabled into VulkanPlatform,
instead of each platform doing its own individual setup
if needed. It also address knowing if a feature or
extension has been enabled, unless we keep adding
entries to the SharedContext which is not scalable.
The createDriver function now have a more defined structure,
mostly how and where features are queried and enabled.
- Get shared context data.
- Create instance if missing.
- Select physical device if missing.
- Query physical device support and set supported
engine features into the VulkanContext.
- Select the queues
- Create the device and queues
* Address review comments
Added some documentation on the new functions
Move the querying and config of features into its
own function.
* Workaround for harmless warning about descriptor sets
The proper fix is difficult and will be handled later. Here we simply
suppress the warning at FL0.
BUGS=[468072646]
* Apply suggestions from code review
The "const char*" used for the string literal parameter of the `feature`
method becomes invalid once it passes outside the Java binding scope,
leading to invalid data access. This fix ensures the string is safely
stored.
Add support for heterogeneous lookup in associative containers that
use CString keys. Add conversion operators for std::string_view and
raw string literals to CString.
When emulating UBOs for feature level 0, we need to use packed
mat33 as source of glUniformMatrix3fv which doesn't expect the std140
alignments of UBOs.
FIXES=[468092808]
For reasons unknown, selenium will freeze when trying to make
request to the local server serving the markdown files. We add
a delay between the server and the selenium driver to hopefully
address this.
DOCS_FORCE
webgpu: refactors WebGPU Platform so each OS environment has its own WebGPU Platform
class derived from the same base, and use virtual functions for their own implementations.
The breakage is due to breaking changes in the latest version.
We use the repo checked-in version instead.
Also make sure postsubmit.sh script exits on any error
* add support for AHardwareBuffer to the java bindings
Texture.setEXternalIamge() now can take a AHArdwreBuffer Java object
as a parameter.
* add an API to set the priority of the Skybox
by default the skybox is always drawn last (priority 7) in order to
reduce overdraw. however, when depth culling is not enabled, it
needs to be drawn first. The new Builder::priority() allows to set
an arbitrary priority for the skybox.
* add rendertarget support for external textures
This was in fact mostly already supported, we just were artificially
preventing that usage. It is supported by the EGL_external_image
extension.
It's the responsibility of the caller/user to not attempt to use an
incompatible format, which has undefined behavior.
FIXES=[466395306]
* add a new android sample to test the AHardwareBuffer as render target
---------
Co-authored-by: Powei Feng <powei@google.com>
This change adds support for the KHR_materials_dispersion glTF extension, which introduces a dispersion property for refractive materials.
The dispersion property controls the angular separation of colors transmitting through a refractive object, allowing for more realistic rendering of materials like glass and diamonds.
Changes include:
- Added a dispersion property to the material definition.
- Updated the shaders to incorporate the dispersion effect in the refraction calculations.
- Added a new test case for dispersion.
- Updated the material documentation to include the new dispersion property.
this is not an error that should warrant an assertion, since it's
possible for fences to not be supported at all.
FIXES=[467782111]
Co-authored-by: Powei Feng <powei@google.com>
Seems to actually be initializing an engine
Failed with
reason: /Users/runner/work/filament/filament/filament/backend/src/opengl/platforms/PlatformCocoaGL.mm:177: failed assertion 'success == kCVReturnSuccess'
A. Move filament_test_material.cpp to be part of test_filament
(This won't be triggered during the windows build)
B. Add chaining dependencies in third_party/draco/tnt so that
there is no race in writing/reading generate.stamp
-------------
Failures
-------------
A.
C:\a\filament\filament\out\cmake-mtd\filament\test\resources\filament_test_resources.c(1,1): error C1083: Cannot open source file: 'C:\a\filament\filament\out\cmake-mtd\filament\test\resources\filament_test_resources.c': Permission denied [C:\a\filament\filament\out\cmake-mtd\filament\test\test_material_parser.vcxproj]
B.
CUSTOMBUILD : CMake error : Cannot restore timestamp "C:/a/filament/filament/out/cmake-mtd/third_party/draco/tnt/CMakeFiles/generate.stamp": Access is denied. [C:\a\filament\filament\out\cmake-mtd\third_party\draco\tnt\draco_compression_bit_coders.vcxproj]
- Fix Android build in build.sh so that the tools dir are
properly set to corresponding folders for debug vs. release.
- Update/consolidate documentation to explain the Android Studio
workflow better.
- Move documentation from outdated apps folder to BUILDING.md
- only MapAsync the staging buffers that are not being used by any command anymore (the commands have finished executing on GPU)
- additionally, in WebGPUQueueManager, create a blank new submission state when a new command encoder is generated instead of in submit()
BUGS=450620535
When the frame history's circular queue is full and the oldest
frame is not yet ready to be processed, we must skip the current
frame.
This change ensures that if `beginFrame` is skipped, the
corresponding `endFrame` is also skipped. This prevents data
corruption in the frame history.
Address potential issues in FrameInfoImpl and FrameInfoManager:
- Modify FrameInfoManager::beginFrame to handle cases where the
circular queue is full and the oldest frame is not yet ready,
logging a warning and skipping the frame.
This prevents potential use-after-free or data corruption by
ensuring only ready frames are removed from the history.
FIXES=[466081317]
PlatformEGLAndroid holds onto the current swapchain in order to use
it when beginFrame is called. Usually the swapchain is set just before
beginFrame is called. However, that's not the case for standalone
views. These are independent of the swapchain and doing "swapchain
stuff" for them is nonsensical.
So make sure that:
1. PlatfromEGLAndroid doesn't hold onto a dangling pointer when the
swapchain is destroyed. And add proper null checks.
2. Don't do the "swapchain stuff" when beginFrame is called in the
context of a standalone view.
We now reserve frameID 0 for that purpose (meaning the frameid is
non sensical for these).
We're currently relying on frameID to not wrap-around. At 120 fps,
that's about 1 year. This will be addressed in a later PR.
FIXES=[462827028, 461399487]
filament_test_material should not need to depend on a "fixed"
(or checked in) material.
Now the dependent .filamat is generated as needed as is
packaged with the checked-in test_material.filamat as before.
also
- update the android build script to pull the version from
build/common/versions
- remove the ability to specify your own ndk version (this was
undocumented and not fully implemented)
The NDK version now needs to appear in two place (unfortunately):
1. build/common/versions
2. build/android/build.sh
`-mcpu` is intended to target a specific CPU instruction set and
optimization. That's not what we want to do here. What we want is
target an architecture, specifically armv8-a. So we use `-march`
instead. On 64 bits builds, we tune for cortex-a78, which is the
df the Pixel7 era. This doesn't mater much, but might give a little
boost on newer CPU cores. The idea here is that we care "less" about
older CPUs.
- Make sure that renderdiff fails when either building or
rendering fails (the previous problem was in the use of &&
that masked the non-zero exit).
- Make sure that golden branch is properly parsed in
postsubmit.yml
- Disable vk loader debug by default
This change fixes an intermittent crash caused by a thread race
condition.
The crash happened when a CallbackHandler::Callback (triggered by
engine.flush()) attempted to create an instance of a Structure of Arrays
(SoA) like TransformManager, which adds items to SoA) at the same time
that the garbage collection job (FEngine::gc, which removes items from
SoA) was running.
This conflict is resolved by modifying the logic to ensure that the
garbage collection task completes synchronously before the callback
operations begin.
* Adding the begin frame message for later xtrace post processing.
* First commit
* This is not needed
* Bypass the AHB* issue.
* Typo: Forgot to remove the function.
* Typo: No const specifier.
* Removing the const.
* no exception
* Feedback from discussions with Powei.
* Making the changes discussed with the team.
* Removing useless comments.
* Adding the required methods for allocation.
* Forgot one more switch case.
* Moving the resource to fvkmemory::Resource type.
* Adding streamed set.
* Allocating every frame for streamed textures.
* Changing the binding logic.
* Proper checks for the streamed texture.
* Cleanup.
* Chaning the logic of the state tracking for streamed textures.
* Fixed full screen bug.
* Refactoring of the code.
* Typo.
* GitHub feedback.
* Github feedback
* feedback.
* Typo
* Feedback.
* Feedback.
* Feedback
* Feedback
* Feedback
* Fixing the Android path.
* Fixing the Android path.
* Feedback.
* feedback
* Feedback.
* Nit
* Feedback
* Feedback
* Feedback
* vk: fix update after bind (wrt descriptor set) validation error
In filament, once a descriptor set is bound, we no longer make updates
to it. However, this guarrantee was broken in the external sampler/image
because a colorspace change might necessitate a layout change, and
thereby a new descriptor needs to be generated with the appropriate
externally sampled image updated in the new set.
Another use case is the Stream API, where each frame we might be
getting a different AHardwareBuffer, meaning we need to update one
or multiple sampler bindings in a set that might have been bound in
a previous frame.
In this change, we always create a new set when there's a change
in the image currently bound to an existing set (while accounting for
whether we need to use a new externally sampled layout or not).
* Removing the decision on whether to use external format or not out of the streamed texture manager. The issue is that all textures are external, not all are using external format. But it's more robust to let the external format image manager rely on the AHB* to decide if the format is external or not. Regardless (because the memory is external) we need to send this to the external image manager.
* Fixing the validation layer in the Stream CL.
* Typo and comment clarification.
---------
Co-authored-by: Powei Feng <powei@google.com>
Depth testing come with a cost, so when the depth
test is marked to always pass and writting to depth
buffer is disable, just disable the feature.
This will also match the GL backend behavior.
- this is not true fro headless swapchains
- and potentially some timings might not be available on a given nativewindow
Previously the code would handle these errors gracefully, but the
errors were still generated. Now, we query the availability and only
make the calls if supported.
Also on EGL, we don't attempt to use private APIs -- this code path
should never be used anyways.
The frameId coming from a Renderer must be monotonic when seen from
a SwapChain (Specifically a ANativeWindow on Android), if it's not
the case, we must clear that part of the history.
This can happen if a SwapChain is used with two different Renderer; at
this point that SwapChain's history is no longer connected to that
Renderer.
These headers are private but were used by public headers.
Refactor the platform code so that these headers stay private.
AndroidNdk.h is treated differently, it is now made public because
it simplifies a lot of things to be able to have the platform concrete
implementation derive from it.
The root of the problem is that in the main rendering loop we need
to set the correct per-view descriptor-set based on the material and
variants.
But we have two cases, either the descriptor set is always constant,
which is the case with ssr, structure, shadows and postfx passes, or
it need to be dynamically changed based on the material & variant.
In the 2nd case, where was a problem where the postfx descriptor set
could be used, which is wrong (e.g. while rendering shadows we need
the shadow UBO, even with a postfx material), and would corrupt the
correct descriptor set, which would never be set back.
Another issue was related to running a custom command, it could
change the state without updating the local copy, causing corruptions
or validation errors.
In this CL we:
- use the same descriptorsetlayout for both postfx and depth
- invalidate the state after a custom command
- only switch to postfx descriptor set in dynamic mode (color pass)
This fixes setChannelDepthClearEnabled() which could cause
validation error, corruption or crashes.
FIXES=[459567258]
* VK: Add support for getting pipeline creation stats
When debugging is pipeline compilation related hitches
is useful to know more information about what happened
when building a new pipeline.
By levering the VK_EXT_pipeline_creation_feedback
extension, we can know if the pipeline creation was
speed up because of a cache hit, how much time it spent
creating it and also the stats related to each
pipeline stage.
This is only available when using the debug flag
FVK_DEBUG_SHADER_MODULE.
* Fix the unused build error
Doing a renderdoc capture when using transient memory
or importing AHardwareBuffers into Vulkan, makes it fail,
crash or not replay properly.
To improve the capture support, added a new constant to let the
backend know when renderdoc is expected to be used and configure
things appropietly.
- In the case of transient attachments that uses lazy allocated
memory, it will be disabled.
- In the case of AHardwareBuffers, a more robust memory heap
selection algorithm will be used.
Also a new VulkanPlatform function will be added, to let other
subclasses know that the transient attachments are enabled or not.
For sample-gltf-viewer, an asset was checked into the source tree.
But other assets are generated or copied from asset directories.
We remove the checked in gltf and copy the asset over during
build (as with other existing files).
* improve camera precondition checks and default state
- Camera is now initialized with a default projection matrix with
left/right, top/bottom set to (-1,1) and near/far set to (0.1,1).
- setLensProjection() and setProjection(FOV) now check the near/far
precondition (near>0 and far>near).
- sanitize user's light near/far to avoid infs and nans during
froxelization
- finally froxelizer asserts that near>0 and far>near on debug builds.
FIXES=[458030186]
* Move the include resolution functionality to matp
- matp::MaterialParser now has a function resolveIncludes that returns a pair of status and resolve string.
- all the include resolution classes are moved to matp private src.
- matp::resolveIncludes is renamed to matp::resolveIncludesRecursively and only used internally.
- added insertLineDirectives and insertLineDirectiveChecks in Config; add those in the CommandlineConfig.
- moved output format to public use.
Note: MaterialParser::resolveIncludes could take a includer instead of the materialFilePath, but i decided
to go with the materialFilePath because the most common use case is resolving from the file's directory.
This allows the parser to just create the default DirIncluder internally, and we don't need to expose it publicly.
* add const to the buffer param
queryFrameTimestamps() and queryCompositorTiming() are both
synchronous APIs, but VuklanSwapchain is not a thread-safe
ref-counted handle (i.e. fvkmemory::ThreadSafeResource). We move
the Platform::SwapChain* pointers to a thread-safe map that is
mapped by the handle id.
* HandleAllocator::deallocate() was unsafe
It needs to know the concrete type to call the proper destructor, so
if it was given a base type handle (e.g. Handle<HwFoo>) it would not
destroy it properly.
* add AsyncJobQueue::cancelAll()
* Fix a race condition when tearing down FrameInfo
It is actually invalid to destroy a Handle<HwFence> while inside
fenceWait().
Updated the HwFence implementations so that they don't pretend they can
handle being destroyed during fenceWait(), they can't.
FrameInfo now cancels all the pending callbacks and waits for the
currently executing one to terminate, *before* destroying the
handles.
Reenable the gpuFrameComplete metric, as it should be working now.
With minSDK less than 26, it's unsafe to use APIs in nativewindow.h
that appeared at API 26 or more, even when using the weak symbol
technique. This is because pre 26, libnativewindow.h didn't exist and
therefore the build system cannot link against it.
Currently Filament's minSdk is 21, which means we should never use
nativewindow.h API after 26.
In this PR we chose the strategy at compile time; either the more
modern weak symbol or the old way with dlsym based on __ANDROID_API__.
- Adjust order of destroy call in both headless and platform
swapchains. We need to be careful of the order due to
assumptions made by the base class's destroy().
- remove `=0` since VulkanPlatformSwapChainBase::destroy() has
an implementation.
Fixes#9403
We refactor VulkanPlatform so that getSwapchainInstanceExtensions()
and createVkSurfaceKHR() are virtual functions that are implemented
by each platform. This will enable the use of polymorphism for
platform-dependent bits.
* use choreographer to access the system's expected present time
* more Android specific code into VulkanPlatformAndroid
* Fix race-condition between init() and terminate()
it was possible for the thread to not have been ready by the time
we call terminate.
* fix build and minor fixes
* Move resolving #includes from MaterialBuilder to MaterialCompiler, before parsing the material.
- resolving #includes was happening after parsing, now moving before parsing.
this is because we could offload this resolution at build time for RuntimeMaterialCompiler
- filamat::resolveIncludes used to have an assumption where the given text was already
a shader block. this assumption is now broken so it finds the line offset internally.
thus the line offset field is removed from IncludeResult.
* Move include related classes to matc
* adds third_party/libwebp and cmake option to enable building it.
* disable simd and default disable pthreads for webgl builds.
* ensure non-empty config var value
* Added notes on libwebp change to NEW_RELEASE_NOTES.md
* Update NEW_RELEASE_NOTES.md
Before the transformName field was expected to be
used together with the stream API, that is not the
case anymore.
In the scenario that isn't using the stream API,
filament will try to associate the transformName
field to a stream that doesn't exist, causing a
crash.
* Check for null fences to avoid segfault in tests
In some test environments, creating a sync or fence backed by an Android
fence returns null. In order to avoid NPEs, cover this scenario with a
null check.
* Address PR - add log statement
Log that native fences are not supported when unable to create a native
sync fence.
Building tools separately is necessary for the existing
cross-complation usecase. We generalize this by introducing
two cmake vars that enable exporting and importing
prebuilt tools.
The intended usecase is to enable ASAN-built filament without
having to run ASAN-built matc (which is prohibitively slow).
build.sh has been modified to add a `-y` flag forprebuilding
tools.
WebGPU's rendering of bloom sems to be non-deterministic. This
is not expected. For now, we disable bloom+webgpu to avoid
hitting flakes in our CI.
This required a slight refactoring of the test configuration
parsing and execution scripts.
RDIFF_BRANCH=pf/renderdiff-disable-bloom-webgpu
* Use a custom, non-allocating map for frame ids
* use memory_order_relaxed for the id of heap allocated handles
* Added displayPresent time to FrameInfo
To do this, we added support for queryFrameTiming() to the backend,
as a synchronous API. Then FrameInfo uses it to update the
corresponding history entry.
displayPresent time can be used to detect "buffer stuffing", i.e.
when the GPU gets too much ahead of the display. Currently
the information is returned to the user only. Eventually filament will
make use of it to determine if a frame skip is mandated.
* API BREAK: rename frameTime to gpuFrameDuration
* FrameInfo now contains compositor timings
- the presentation deadline
- the refresh rate from the display
- the composition-display latency
* set FrameInfo data to INVALID if feature is not supported
report presentDeadline properly.
The deadlock happened because FrameInfoManager needs to wait that all
fences have signaled before it can be destroyed.
The fix here is simply to destroy the fence without waiting (for safety
we do wait after we destroy them).
This uncovered another problem where all backends didn't handle this
correctly.
We now explicitly handle this when destroying a fence: we make sure it
unblocks all the waiters and returns an error.
on mobile h/w, strong highlights generated by the lighting stages can
turn into +inf and eventually to NaN if more math is performed on them.
Some h/w will kill a while tile or even primitive when that happens,
resulting in strong visual artifacts.
We fix this by clamping to MEDIUMP_FLT_MAX.
* GL: Fix importing non srgb using the external image API
When importing a non srgb AHB but setting the srgb as true,
makes the eglCreateImageKHR function to fail because it tries
to set the colorspace as srgb for non srgb formats.
Example:
createExternalImage(yuv_ahardwaredbuffer, /*sRGB=*/true);
The fix is to only make sure that flag is set to true
if the corresponding filament format requires sRGB and
false otherwise.
* Fix mapToFilamentFormat to return the correct srgb formats
* fix build error on android
---------
Co-authored-by: Serge Metral <sergemetral@google.com>
Fix the callback by using a shared_ptr to store the callback.
The same logic exists in all other backends.
Re-enable corresponding backend test for webgpu.
Remove viewport size check in beingRenderPass. There is no similar
check in other backends.
Fix the callback by using a shared_ptr to store the callback.
The same logic exists in all other backends.
Re-enable corresponding backend test for webgpu.
Remove viewport size check in beingRenderPass. There is no similar
check in other backends.
Previously, Cleanup is scoped to the testing function, which will
go out of scope before BackendTest's destructor is called. We
need to order the cleanup (destruction of resources) to after
the readPixels and previous commands are complete - which is
in the destructor of BackendTest.
Additionally, we need to cleanup before the destruction of the
driver. This means we need to be able to order the destruction
of Cleanup (and not rely on RAII). This is done by having a
unique_ptr holding a Cleanup instance.
* Add Compositor Timing APIs to Platform
These APIs are currently modeled after Android capabilities, but a lot of
the concepts are generic enough to map to other system with a compositor.
This adds Platfrom::queryCompositorTiming() which is currently only
implementd by PlaftormEGLAndroid. Vulkan and WebGPU will come later.
The functionality is implement via EGL, but a new NativeWindow
helper is provided to access the same data from non-EGL backends.
Also to be on the safe side, PlatformEGLAndroid reverts to using
the ANativeWindow if EGL fails.
This CL also cleans-up PlatformEGLAndroid to accomodate those changes.
* Add queryFrameTimestamps() API to Platform.
This API allows to query very precise timing information of
past frames on a given swapchain. This information is provided
by the Android framework via EGL or ANativeWindow (albeit
through private APIs).
Currently only implemented by PlatformEGLAndroid.
SwapChainEGL is now implemented more idiomatically. It has a
constructor that does the initialization. This allows subclasses
to be implemented properly and safely.
PlatformEGL::createSwapChain() now just constructs SwapChainEGL and
does nothing else, which allows a subclass of PlatformEGL to "add" to
the PlatformEGL swapchain, buy simply subclassing from it and
constructing it normally.
The SwapChain doesn't need to have a vtable because polymorphism
is handled by the concrete Platform implementation.
Here we also implement a no-op SwapChainEGLAndroid to show how easy
it is to extend the swapchain. This functionality will be used soon.
- Also modify update script
- Renamed to update_remote_ui
- Repair path inside sciprt
- Ensure update script is not copied over to /docs
- Add requirements.txt (for python/pip dependencies)
- On webgpu, do not error on linux when we're building headless
only (without platform support for surface).
- For test/backend/test.sh, enable path for building on
Linux + 64-bit x86
If createSwapChain() fails, a SwapChain object is always returned
(this might itself be a problem, but we can address that later),
however in that case, destroySwapChain() would leak the EGLSwapChain
structure.
This commit enables running the backend tests for opengl and
vulkan on github CI. The script is located in test/backend.
We also add exceptions (SKIP_TEST) for the currently failing
tests. Issues have been filed to track addressing these failed
tests.
We also disable a series of broken webgpu tests.
* Add new public API to query a sampler transform name field.
This new API will let filament users query a Material object
the value of the `transformName` field of a specified sampler
parameter.
The transformName is an optional field, so if its not defined
by the user, it will return a nullptr value.
- A new test was added to test_filamat to validate the serialization.
- A new parameter was added to the test sandboxLit material to
validate the parsing a material with the new field.
* Addressing review comments
- Add java and js bindings for the new API
- Tests for querying the getParameterTransformName
* Use utils::ImmutableCString for transformName
* Updating release notes
* Review comments
* Addressing more review comments
- Fix comments
- For the java binding return an empty string when the
transform is not present.
Adds support for compiling filament libraries with GCC. Since GCC is not
officially supported, we prefer to disable warnings (incl. not treating
warnings as errors) rather than updating the code in order to compile
cleanly.
This flag is disabled by default.
nanosecond is long long and `timeout` is uint64_t. This creates
an overflow when timeout is too large (for example
timeout = std::numeric_limits<uint64_t>::max() when waiting
forver).
* Add missing includes.
* Add parenthesis around operators to suppress compiler warning.
* Remove duplicate definition of is_supported_aux_t.
* Explicitly create descriptions.
* Remove usage of anonymous struct with non-trivially constructible members.
This is an error on some compilers (e.g. gcc).
* Remove unnecessary rvalue-reference on pointer type.
* Explicitly construct SamplerParams to suppress compiler warnings.
* Place attribute specifier before declaration.
* Remove usage of anonymous struct with a non-trivially constructible member.
Replace the `array` union member with an `operator[]` to provide similar
functionality.
Some compilers (e.g. gcc) do not support this non-standard use-case.
* Use same warning settings as main filament project.
- Add transmission and ssao tests
- Small mods to README.md
- Add transmission models to gltf list
- Change focal length to zoom in for more details
RDIFF_BRANCH=pf/renderdiff-add-transmission
Context:
- Picking has switched to use integer textures and this texture
is meant to have only RG components (#8917).
- WebGPU only supports 4 component textures, and so we need to
to a blit-based transform to turn 2 components into 4.
- WebGPUBlitter supports only float textures
In this commit, we add support for integer textures to
WebGPUBlitter. In doing so, we refactor parts of the shader
construction code in the blitter class and introduce a couple
helper functions for texture formats.
This fixes picking (verifiable with gltf_viewer)
Co-authored-by: Ben Doherty <bendoherty@google.com>
`--headless_only`
Headless-only mode indicates that we will only use headless
swapchains. This is particularly useful if we want to test in
a CI (continuous integration) environment.
`--ci`
Having CONTINUOUS_INTEGRATION as an OS will allow us to have
CI-only temporary exceptions. Though it's expected that some
exceptions will be unfixable and will remain as workarounds.
If we assign the message (which might contain quotes) to an
environment variable and then echo it, this should prevent the
problem of having a double quote (").
Also fix a problem in docs script for checking TAGs in commits.
To enable the readPixels callback to be called, we need to make
move to 'AllowSpontaneous' mode in order to not have to call
Instance::ProcessEvents() to force process the callback.
* Introduce AllocationStrategy and its tests
* feedback
* feedback
* Add stress test
* Fix the build
* Minor fix
* Rename the class
* Rename
* Make const
In GLES the anisotropic filtering featuring is always
disabled even in the cases where is supported by the hardware
because the check for the extension is missing.
* Add a Renderer API to force skipping frames
Renderer::skipNextFrames(size_t) can be used to force filament to
pretend the next N frames must be skipped. This is mostly useful for
debugging.
* Add DebugOptions to Settings
We still need to move the "Debug" features of gltf_viewer to this,
but this give us a framework to do it.
Currently there is one debug option that allows to set a number of
frames to skip.
ViewerGui propose a button to skip 10 frames using this framework
* Update libs/viewer/src/Settings.cpp
Co-authored-by: Powei Feng <powei@google.com>
* Update libs/viewer/src/Settings.cpp
Co-authored-by: Powei Feng <powei@google.com>
---------
Co-authored-by: Powei Feng <powei@google.com>
The Glslang SPIR-V remapper was removed, and replaced by the CanonicalizeIds
pass in spirv-opt. See https://github.com/KhronosGroup/SPIRV-Tools/pull/6174
Filament's GLSL post-optimization algorithm already runs CanonicalizeIds.
Bug: b:450891564
* fix a possible deadlock in AsyncJobQueue
drainAndExit() could get stuck because it waited for the job
queue to be empty, but that was not signaled.
in fact, drainAndExit() didn't need to do that.
* Improvements to FrameInfo
- return the GPU Complete timestamp
- return the app VSYNC timestamp
- works TimerQueries are not supported
The VSYNC time is just a convenience as it is the same value
provided by the application during Renderer::beginFrame() or via
Renderer::setVsyncTime().
it used to return false when setting the same value for the constant,
which other code used to invalidate the material or not. but it
was recently changed to always return true on success.
this reestablish the previous behavior.
Using struct as keys simplifies the parameter definitions of the
relevant pipeline, pipelinelayout, shader module methods. This
enables adding or removing fields without adding major changes
to method definitions.
Using utils::hash::MurmurHashFn also aligns with the style of
the rest of filament.
* Add a workaround for Filament's breaking change to add_subdirectory for Abseil, see: https://github.com/google/filament/issues/8611
* Fix #pragma warning syntax for MSVC
* Only search for an external Abseil dependency if a new option FILAMENT_USE_EXTERNAL_ABSL is set
* Make JsonishParser use utils::Status
- add unsupported error in utils::Status
- add invalid case in the test
* return a pair of Status and string in resolveEscapes;
use initializer list for JsonishString and move that to the header.
This is needed to instantiate `std::streampos`. It currently relies on transitive header inclusion to get that, which is going away for libc++ in ebcf1bf2ec.
- --no_rebuild will skip building the gltf_viewer again
- --num_threads will limit the number of threads used in running
the rendering test.
Both of these options are meant for debugging locally.
- Add WebGPUQeuueManager to manage queue submissions
- The manager will keep a "last status" field that will track
the status of the last submission.
- Any created HwFence will be associated with a status object.
- The object updates in a callback that indicates that the
submitted workfload has been completed.
This change addresses a platform-specific issue on Windows where shared
OpenGL contexts must be created on the same thread as the primary
context.
To resolve this, we now pre-create a pool of shared contexts when the
driver is initialized. These contexts are then distributed to other
threads as needed, ensuring shared context creation requirement on
Windows. This allows us to be able to use THREAD_POOL mode for shader
compiler service on Windows. So Windows build uses THREAD_POOL mode
instead of ASYNCHRONOUS mode as of this change.
This change also refactors the shader compiler service to catch and
report errors in the same thread where the program compilation and
linking actually performed as it's the correct way to use shared
contexts. Otherwise it may crashes.
* Use utils::Status in MaterialParser
* Use utils::sstream instead of std::stringstream
* Remove remaining std::cerr and dep; update MaterialParser::reflectParameters
* make error message in utils::Status more generic
---------
Co-authored-by: Powei Feng <powei@google.com>
- Fix the magnifier positioning for both compare and standalone
mode. Simplified a lot of the logic and streamlined passing
of states between components.
- Slight css adjustments
ImmutableCString is a string class similar to CString except it's
immutable. ImmutableCString occupies 16 bytes instead of 8 for CString.
However, ImmutableCString is able to avoid memory allocation when
constructed from a string literal, and in that way it us similar
to StaticString.
ImmutableCString can be auto converted from StaticString.
The backend tag tracking is updated to use ImmutableCString and
the FrameGraph resource manager us updated to use StaticString.
Together these changes significantly cut down heap allocations due to
internal tagging.
We also add optional tracking to {Immutable}CString.
* Minor changes in utils::Status
- << operator doesn't have to be friend
- simplify getErrorMessage to not use strlen internally
* Replace std::ostream to utils::io::ostream
* utils: RefCountedInternPool/RefCountedMap
First, introduce RefCountedInternPool, a reference counted intern pool of
Slice<const T>. Just acquire() a slice that you want and you're guaranteed to
get exactly one canonical value-equal Slice<const T> back.
Additionally, introduce the concept of NullValue to RefCountedMap. A NullValue
defines what should be considered an uninitialized value; by default, it's the
default value of that type (0 for ints, nullptr for pointers, etc). This allows
us to lazily-initialize values in the map. A client can acquire() a bunch of
different resources which will be initialized only when get(factory) is called.
If a client attempts to get() a value without specifying a factory, and the
value is not initialized (i.e. equal to NullValue{}()), RefCountedMap will
panic.
* utils: add unit tests for ref-counted collections
* utils: remove C++20 features, fix memory issue
* utils: remove RefCounted from InternPool
* engine: change spec constants to simple list
For a shader program cache to be keyed on the set of spec constants that a
program has set, we need to know full exact list of constants, including their
default values. If we're going to always hold a list of all constants all the
time, then we may as well store them as a simple list where each index is the ID
number of the spec constant.
As part of this change, we now write the default values of spec constants into
the material file metadata.
* fix indent
* engine: fix sRGB swapchain emulation
* slice: fix memory semantics
* slice: prefer passing slice by value
This lets us do nice things like coercing Slice<T> to Slice<const T>, etc.
* slice: fix unit tests
* slice: fix copy/assignment, hash function
Don't attempt to define a copy constructor/assignment operator which would
convert a constant type to a mutable type.
Additionally, fix the hash function such that we're hashing U instead of const
U.
* new utility AsyncJobQueue
this is a very simple job queue, it spawns a thread and runs the jobs
pushed to the queue in sequence.
* use AsyncJobQueue in OpenGLTimerQuery
The viewer supports pulling artifacts based on PR number, and now
we support providing Run ID as an alternative to identify the
renderdiff run on Github CI.
In the current implementation, the function std::cout is used inside a signal handler. This is problematic because std::cout is not
async-signal-safe. According to POSIX standards, only a small set of
functions are guaranteed to be safe when called from signal handlers,
and std::cout is not one of them. Using non-async-signal-safe functions
inside signal handlers leads to undefined behavior and can cause
crashes, deadlocks, or other unpredictable issues.
By making these changes, we avoid undefined behavior and ensure the
program can handle signals safely.
* new fenceWait() API in the backend
* correct implementation of fenceWait() for GL and WebGPU
- fenceWait() now works correctly if called before the fence is
created on the backend side
- the STL's condition wait_for() is actually a wait_until, which
means we have to make sure now() + timeout doesn't overflow.
- also we make sure to keep a reference to the fence internal state
while we wait so that we're safe if it's destroyed during that time.
* Implement fenceWait() properly on vulkan
On Vulkan, unfortunately, the implementation is complicated, as we
need three levels of "wait".
First we need to wait using a mutex/condition that the shared fence
is created (this is because on vulkan, all HwFence share the same
"state" associated to the same command buffer).
Once we have that, we need to wait for the VkFence to be submitted,
this is done using a read/write lock and condition variable. The
read/write lock is not needed at this stage, but in the next.
Once the fence is submitted, we can now wait using vkWaitForFences,
however, external host synchronization is needed. Multiple
vkWaitForFences can be issued together (and use the read lock), but
must be mutually exclusive with vkResetFences and vkQueueSubmit.
By construction, we know that this can't happen during vkQueueSubmit
due to the "2nd level" of wait, however we need to prevent
simultaneous calls to vkResetFences, this is done using a write lock.
By construction, we're guaranteed that when vkResetFences is called,
the fence has signaled, we just need to wait for all vkWaitForFences to
return.
A side effect of this change is that fenceGetStatus() has a better
implementation, since it's just a wait with timeout of 0.
* Update filament/backend/src/vulkan/VulkanDriver.cpp
Co-authored-by: Powei Feng <powei@google.com>
---------
Co-authored-by: Powei Feng <powei@google.com>
The parser object was accessed to generate a key after being passed to
the lambda using std::move(). This led to a crash on certain platforms
(at least on Windows).
This change fixes it by creating key first before moving the parser
object into the lambda.
Since #9259, CString in VulkanPlatform fall into the literal
constructor path. But we really want the null-terminated
(char const*) path. So we cast the strings to (char const*)
to enforce null-teriminated behavior.
RDIFF_BRANCH=pf/renderdiff-add-tolerance
Since #9259, CString in VulkanPlatform fall into the literal
constructor path. But we really want the null-terminated
(char const*) path. So we cast the strings to (char const*)
to enforce null-teriminated behavior.
* VK: Allow memcpy of vertex/index buffers in UMA
- Renamed VulkanBufferUsage to VulkanBufferBinding
to avoid confusion with the BufferUsage enum.
- In UMA all buffers are persistently memory mapped.
- In the case of static buffers that are memory mapped
use memcpy directly to update their contents.
* PR Comments
The corruption seems to be triggered with a combination of using:
- spirv-opt
- RGBA16F (as opposed to e.g. RGBA8)
- framebuffer_fetch
In this CL we disable framebuffer_fetch for drivers we know have the
issue.
FIXES=[445721121]
Fix#7794
- Add a VulkanSemaphore ref-counted class to track the references
of a semamphore - i.e. in a command buffer or in a present.
- Add a VulkanSemaphoreManager class to keep a pool of
VkSempahores for better re-use.
This fixes a validation error where we were re-using a semaphore
that is associated with a command buffer while its being used
in a present (as a wait signal).
Error ris VUID-vkQueueSubmit-pSignalSemaphores-00067
* material cache: address comments
* material cache: simplify CRC32 comparison
* material cache: == if same address
* material cache: use plain type for cached crc32
Allow returning a list of supported shader languages
instead of only one.
Notify the backend which is the preferred language.
In the case of metal, the preferred language will be
the first element in the list.
This change will allow a backend to support multiple
languages as needed, in the case of the noop driver,
it will support a material with any shader languages.
* materials: introduce MaterialCache
Presently, Filament Materials are instantiated by first parsing a bunch of
read-only data from a material file, then applying a bunch of options from its
Builder before settling on a final, immutable Material object. If two different
Material instances need to be parameterized differently, e.g. setting their spec
constants independently, each has to do all of these steps independently for
each variation.
This change introduces two new concepts: MaterialDefinition, representing the
deserialized, read-only state of a material file, and MaterialCache, a
reference-counted system responsible for managing the lifetimes of
MaterialDefinitions. Now, each Material asks the cache if a MaterialDefinition
exists for the particular UUID of the data it's trying to read; if not,
MaterialCache creates a new entry transparently. If a hundred different
Materials all try to load the same material data, only one
MaterialDefinition (and its associated GPU resources) will be created.
This first PR is the least possible invasive implementation of this feature.
There are a lot of room for improvements (and more planned). For example, each
Material still manages its own compiled shader program cache, but we can easily
move this to the MaterialCache in future PRs, further enabling the planned
mutable spec constants feature.
Additionally, there's room here to add a Material::toBuilder() method, which
could take an extant material and create a Builder object from it already
parameterized with all of the same options, a la the prototype design pattern.
* material cache: key on crc32
* material cache: make materialParser private
* move RefCountedMap to utils and add unit tests
* material cache: make create functions private
* material cache: fix broken tests on iOS/web
* material cache: address more comments
The reason for this is that according to the GLES 3.0 spec, RG32UI is
guaranteed to be supported for writing, unlike RG32F.
We also use RGBA_INTEGER / UINT for readPixels() which is also a
guaranteed format.
Attempt to Fix#8762
* reorder backend methods
* add new "shared" buffer APIs to backends
We add the equivalent of GL's glMapBufferRange. The new APIs are:
- new "SHARED" flags when creating a BufferObject
- a new HwMemoryMappedBuffer handle
- mapBuffer() maps a range of the buffer to memory
- unmapBuffer() unmaps the range
- copyToMemoryMappedBuffer() is basically a deferred memcpy, where the
destination is a HwMemoryMappedBuffer and the source is a
BufferDecriptor
The actual implementation doesn't have to actually map/unmap the range
on mapBuffer/unmapBuffer. e.g. on Vulkan these method are used mostly
to set offsets (for copyToMemoryMappedBuffer) and trigger the necessary
synchronizations.
Added some basic unit tests.
* add basic support for MemoryMappedBuffer in vk and metal
we implement copyToMemoryMappedBuffer() by calling updateBufferObject(),
which is enough to satisfy the API (And pass the tests).
This saves a CString copy on the backend side and this forces the
frontend to make a copy explicitly.
In theory the CString should now ever be copied just once.
- Allow for presets to override selected models when presented
in order.
- Add 'gltf' for model search path
- Add a few simple gltf models to the 'base' preset
- Improve UI so that missing tests do not generate any html
bits.
- Add documentation on using the viewer
- Add renderdiff documentation to the project webpage.
RDIFF_BRANCH=pf/renderdiff-enable-webgpu
- The vk readPixels relies heavily on DataReshaper to transform
the output into the client's requested format. We make
additions to the DataReshaper to address previously unavailable
features:
- A copy for half floats - Assuming input and output are
both half floats. We just do memcpy.
- Reshaping with respect to PixelBufferDescriptor's top and
left parameters.
- On the test side, we do a bit of clean-up and add the ability
to export image correctly when the PBD has dimensions different
from the readRect and/or non-zero offsets.
- Also re-enable two LoadImage tests.
Make sure that the rendertarget dimensions matches the texture
dimensions. Update the expected image for the test.
Also fixed usage, rendertarget parameters to make sure vk does
not have any validation errors.
Add a way to show the difference between two rendererd image.
This is a convenience feature to see the differences between
backends.
Refactor the ExpandedFailedResult to use this new view.
We need to have an reference to the default render target for
the duration of the backend lifetime. So even if the client
tries to destroy the default render target, we don't actually
destroy it.
Note that it will be destroyed on driver shutdown.
filament/backend/test/Workarounds.h has a specific workaround
with regards to readPixels and texture usage. Originally this
was introduced for the WebGPU backend. This is needed
for the vulkan backend as well.
Also simplify BufferUpdatesTest.BufferObjectUpdateWithOffset
- no need to call flush() or executeCommands(), these are
called when the test terminates.
- layerCount for a rendertarget should be at least 1.
Users can now create a swapchain with MSAA support, which enables direct
rendering to a multi-sampled swapchain image and automatic resolution.
This is only supported by EGL(Android). Other GL platforms (GLX, WGL,
etc) don't support it because the swapchain MSAA settings must be
configured before window creation.
Support for other backends will follow.
BUGS=[433327615]
Hybrid (InstanceBuffer based) instancing no longer needs a
descriptor-set per object because we now use the same UBO for all
objects, so the "shared" per-object descriptor-set can be used.
This also implies that InstanceBuffer doesn't need to track the UBO
handle anymore, only its offset in the buffer.
VulkanDriver::finish() seems like it is waiting for all the
commands to be processed, but in reality, the present calls
are not waited on (because commands->wait() only waited on
the command buffers).
Here we just call vkQueueWaitIdle to address that case.
This fixes a validation error that occurs when running the
backend test BackendTest.MissingRequiredAttributes.
FSwapChain initialization logic would filter out unsupported flags but
would incorrectly use the original, unfiltered flags when creating the
swap chain.
This commit ensures the filtered flags are passed to the driver. It also
adds the warning to log which ones are removed.
BUGS=[433327615]
blitDEPRECATED can also be used in the context of a multisampled
texture resolve. Fix that case to use the resolve() path in the
VulkanBlitter.
Also fixed backend test BlitTest.ColorResolve to add the correct
usage bit (otherwise it'd have validation error).
FIXES=417229577
* Create exportable fences on Android
Also - create a conversion method for the driver api so that a fence can
be converted to an external handle, where available.
* Create a frontend API for external fences
Fences will be called 'Sync' on the frontend, and come with a method for
conversion to an external sync. This will typically be a file
descriptor, for use in posix systems.
* Refactor Sync to rely on opaque handles
Also - push the callback invocations into the backend, such that they
are scheduled on a worker thread, and not run on the Filament backend
thread.
* Address PR comment - minor refactor
Clear vectors after they've been consumed, and update null checks by
removing explicit reference to nullptr.
* Remove convertSyncToFd from non-android
Other platforms might have other handle types.
Also - remove unused header include
* Add logging for convert to fd
Also, remove duplicate includes
* Address PR - change fd type
As per request by rafadavi@, changed to match the Android spec for file
descriptor type, which is `int`.
* Address PR - remove vtable from sync
Also - rename derived sync classes
* Address comment - make SyncCallbackData private
It's technically implementation-specific, even though it currently
happens to be the same. Separate this into the different backends.
* Add stub for metal backend for sync
* Add stub impl for Sync in WebGPU
We need to modify spirv-tools existing CMakeLists.txt to make
sure that its binaries and libs are not included in the filament
installed output.
This change was present before, but overwritten when spirv-tools
updated (wrt the WebGPU project).
In addition to modifying the CMakeLists.txt, we add a script to
carry out the changes automatically when running the update script
in the future.
Fixes#9168
In the cases of a descriptor set being updated
with a external sampled texture but that descriptor
set doesn't get used later on for rendering.
Their corresponding entry in VulkanExternalImageManager::mSetBindings
will never get removed until the application is terminated, causing
performance issues or a fatal crash if run long enough.
The expectation is that the amount of bindings with
external samplers is low or none, so this won't cause
any regression when not using external samplers.
The backend call `isTextureFormatMipmappable` indicates whether
a format can be used to generate bitmap through graphics API.
(The issue is that previously there was a check to validate
whether a format is mipmappable and levels > 1. These two
conditions do not need to imply one another.)
The workaround option is now set to none by default. Use
```
matc -Wall
```
if you want to restore the previous behavior.
Current material workarounds:
- remove MergeReturnPass (except on Metal)
- remove SimplificationPass (except on Metal)
There are reason to believe these workarounds are no longer needed,
due to changes in spirv-opt.
It's possible that older devices might still need them.
These workaround affect *all* devices, this is why it is important
to disable them if not needed.
The script uses os.system to execute external commands like nm and
objdump. Instead we use the subprocess module, which is the recommended
approach in modern Python.
Properly handle potential errors if nm or objdump fail.
The new cmake FILAMENT_ENABLE_PERFETTO must be set to enable
perfetto traces on Android. It is disabled by default on release
builds, enabled otherwise.
The reason for this is that the perfetto SDK adds about 800K of code
to the library. The text section goes from 2.2 to 1.4 MB
This new method, intended for the vertex shader, returns a matrix that
transforms vertices from view space (also known as head space) to the
current eye space.
BUGS=[441127971]
- libbackend (except webgpu)
- libfilament
- libutils
std::string generates a lot of code bloat, we use CString instead.
We also update CString to be more compatible with std::string's api.
The semaphore stages between command buffer didn't consider the
data buffers (UBOS, vertices, indices) being shared across command
buffers
BUG=436853814
- by limiting the maximum number of point light to 255 instead of 256,
we can simplify some loops.
- hint the compiler that certain loop counters are multiple of 16 and
non 0, which helps vectorizing.
The record buffer is were we store the light indices, its maximum
size is 65536 entries, but is often limited to 16384 on about 30%
of Android devices because of the 16KB UBO limit.
This PR makes the record buffer use up to 64K entries when allowed
but the h/w.
The record buffer can be a limiting factor when many lights are used
with many froxels. With the minimum of 4096 froxels and a 16KB record
buffer we get an average of 4 lights per froxel. With our maximum of
8192 froxels and a 64KB record buffer we get 8 lights in average per
froxel.
In EGLAndroid, external textures imported from an AHB
that dont use a SAMPLER_EXTERNAL are not properly destroyed,
causing a memory leak that eventually leads to an OOM.
In some places, this sampler was incorrectly assumed to be
sampler2darray, but it should be just a sampler2d. Additionally,
sampling from it should produce unfiltered values - this has been
changed accordingly.
gltf_viewer on android calls finish before creating any resources.
This causes a hang on OnSubmittedWorkDone for the work that was never
there. Put a check in Driver::finish call to avoid the deadlock.
In ZstdHelper::isCompressed call, `src` may not be aligned to 4 bytes,
which is violating the alignment requirement of
`UndefinedBehaviorSanitizer: misaligned-pointer-use`, thereby resuling
in a runtime failure with UBSan enabled. So reconstruct the 32-bit
integer as a workaround.
Window size should be calculated from windows not screen on XLIB.
XCB window is not implemented in Dawn. Remove the stale/wrong implementation in filament
In the case with external samplers, if another descriptor set gets
bound between draw2(), then we need to check to see if a rebinding
of the pipeline is necessary.
Co-authored-by: Serge Metral <sergemetral@google.com>
FilamentApp now has debugging options to enable or disable the
camera and directional shadow frustums, as well as the new
"froxel grid" visualization.
"froxel grid" is automatically enabled when "froxel debugging" is
enabled in the debug gui in gltf_viewer.
New corresponding debugging APIs were added to View.
Before this change once the froxel vizualizaition was enabled via
the Engine debug framework, it applied to all views. This adds a
debug API on View to control whether the view will display this
vizualization.
If screen-space refraction was used enabled but the thickness
parameter wasn't explicitly set in the material, it would end-up
being uninitialized. Now it's initialized to 0.5 by default,
which is the value used for subsurface.
Also removed some calculations dependent on thickness being set, as
they assumed a thickness of 0.
**If you are merging a PR into main**: please add the release note below, under the *Release notes
We are chaning the way Vulkan buffers are handled. We need to switch over to a managed (or view-based) model where the data stored inside the object is a proxy to a Vulkan object that can dynamically be swapped around.
**If you are cherry-picking a commit into an rc/ branch**: add the release note under the
appropriate header in [RELEASE_NOTES.md](./RELEASE_NOTES.md).
Some files were not shown because too many files have changed in this diff
Show More
Reference in New Issue
Block a user
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.