This will allow for more backend-specific usage mapping then before - where BLIT_SRC and BLIT_DST are assumed for textures whose mipmaps will be generated.
These mappings have been introduced in metal, vulkan, webgpu.
* Make sure that all descriptors are always initialized
* improvements to committing material instances
- from now on, only MaterialDomain::SURFACE material instances are
automatically committed by FEngine at the beginning of a frame.
COMPUTE and POST_PROCESS domains must be committed manually via
a new API on MaterialInstance. Both domains are not public APIs so
this shouldn't have an impact anywhere.
- DescriptorSet now validates that all descriptors are set and emits
an error in the log if not.
- these changes prevent PostProcess material instances to be committed
before all descriptors are set.
* Update filament/src/details/Engine.cpp
Co-authored-by: Powei Feng <powei@google.com>
---------
Co-authored-by: Powei Feng <powei@google.com>
* re-do "Use the Perfetto SDK instead of ATRACE" (#8701)
This time we create an entirely new private header: Tracing.h which
uses the perfetto SDK instead of ATRACE. The old Systrace.h is
unchanged to presever backward compatibility but is essentially
deprecated and no longer used within the filament repo.
The new TRACING_ macros use an explicit CATEGORY parameter, which is
declared in Tracing.h.
Moreover, tracing can be compiled out by defining
FILAMENT_TRACING_ENABLED to false before including Tracing.h
iOS tracing is still supported and still controlled via
FILAMENT_APPLE_SYSTRACE.
There are three perfetto categories defined:
- "filament/filament"
- "filament/jobsystem"
- "filament/gltfio"
The "filament/jobsystem" category is compiled out by default.
And they can be enabled in AGI / perfetto by adding:
```
data_sources {
config {
name: "track_event"
track_event_config {
disabled_categories: "*"
enabled_categories: "filament/filament"
enabled_categories: "filament/jobsystem"
enabled_categories: "filament/gltfio"
}
}
}
```
* Update libs/utils/include/private/utils/Tracing.h
Co-authored-by: Powei Feng <powei@google.com>
* Update libs/utils/src/android/Tracing.cpp
Co-authored-by: Powei Feng <powei@google.com>
* remove all references to SYSTRACE_TAG
---------
Co-authored-by: Powei Feng <powei@google.com>
* validate MaterialInstance references when destroyed
With this change we now enforce two things:
- All MaterialInstance of a Material must be destroyed when
destroying said Material. This has always been a documented
requirement of the public API, but wasn't enforced (only
a warning was printed).
This new assertion is unconditional.
- A MaterialInstance, when destroyed is no longer in use by any
Renderable.
So before destroying a MaterialInstance, the user of API needs to
ensure that either all Renderable using that MaterialInstance in one
of their Render Primitives are destroyed, or, that these Renderable
using that MaterialInstance are reset to another one or to null.
There is a new RenderableManager::clearMaterialInstanceAt() that can
be used to clear a MaterialInstance on a Render Primitive.
Additionally, a Render Primitive with a null MaterialInstance is now
silently skipped during rendering, instead of a null-dereference.
Finally, that second assert is protected by a new feature flag:
"features.engine.debug.assert_material_instance_in_use". This flag is
enabled on DEBUG builds and disabled on RELEASE builds by default.
The flag can be changed at any time using `Engine::setFeatureFlag()`.
BUGS=[333907416]
* Update filament/src/components/RenderableManager.cpp
Co-authored-by: Powei Feng <powei@google.com>
---------
Co-authored-by: Powei Feng <powei@google.com>
cmgen mirrors environment maps by default so that the reflection map
appears un-mirrored. IBLPrefilter didn't do that.
EquirectangularToCubemap now takes a Config parameter that allows to
specify the mirroring, which is enabled by default.
FIXES=[320856413]
it was incorrectly mapping the equirect image to a cubemap due to a
typo in our overload of atan2 which was swapping its parameters.
atan2 is now removed, and we use atan(y,x) instead. Also modified the
code slightly so it matches almost exactly cmgen's.
FIXES=[320856413]
The most important change here is that we no longer apply the
backend (e.g. Metal/Vulkan) UV transformation before calling the
user's vertex shader. This is an API change for post-process materials
(but they're not public).
Now the user is responsible for using uvToRenderTargetUV() in their
shaders (either in the fragment or vertex as appropriate).
This makes it easier to handle offsets/transforms with all APIs.
Conceptually, the only thing that is needed is to call
uvToRenderTargetUV() just before making a texture call.
This fixes a couple of issues:
- some image shifting in metal/vk
- flare in metal/vk was upside down
We also simplify the DoF code quite a bit now that we can rely on the
rendertargets begin multiple of 16.
We also "fix" SSAO that was working by accident on metal/vk. The UV
correction was applied 3 times 2 of which were canceling each other.
- the hammersley sequence was completely wrong because of a missing
highp precision qualifier
- roughness 0 was also wrong because of divide-by-0
Fixes#4668
The finalizer can't be used to dispose of filament resource, because
it runs on its own thread.
Added a destroy() method to all IBLPrefilter related classes that must
be called once the object is no longer needed.
note: Resources will be freed eventually anyways when the Engine itself is
destroyed.
fixes#4633
- move kernel weight computation to the gpu side as a small cost, in
order to simplify the CPU side and reduce the binary size.
- skip samples with a weight of 0, which is a completely coherent
check.
- fix a typo in move ctor
- move public headers from filament/foo to filament-foo/
to avoid confusion with libfilament's headers
- add support for equirectangular to cubemap conversion
- add support for using an .hdr file directly in all our samples
- the miplevel wasn't computed correctly
- the random rotation was incorrect
- the default HDR compression was too aggressive
- better validation of the input cubemap
we now store the kernel for each lod in a texture, this has several
advantages:
- the texture can be reused, so we can amortize that cost a bit
- we could generate the texture with a shader, so that we don't
have to do any texture uplaod (TBD).