We link the behavior of certain precondition/postcondition checks to feature flag states.
- If provided *flag* is true, then this macro will assert when the *condition* is false.
- If provided *flag* is fase, then this macro will output a warning when the condition is false.
- If the condition is true, then neither of the above will happen
These two macros will enable us to provide less restrictive behavior for certain correctness assertions, allowing clients to modify their before enabling these assertions by default.
The PER_VIEW UBO was updated by different render passes at different
times, which created synchronizations on the GPU, between unrelated
passes and prevented the vertex shader to run on parallel with another
pass for instance.
In the PR, we fix this by moving ALL the UBO set-up outside of
render passes. It's now done early, just before creating the framegraph.
The PER_VIEW UBO is shared between several passes, themselves using
different descriptor sets; so we need to make sure all the data
necessary for these passes is computed and set in the UBO (e.g. SSR
passes).
The passes themselves (like the color pass) still set the textures and
UBOs in their descriptor sets, but then no longer updated the content
of the UBO itself.
In this PR we also remove some "fake" dependencies between passes due
to descriptor sets straddling between passes. This is done by unbinding
all descriptor sets at the end of each pass. The PER_MATERIAL descriptor
set is a bit special because it should be unbound between full screen
quads draws.
Additionally, there some places in the code attempting to update
UBOs only when the content was dirty were missing a "clean" call, to
reset the dirty bit to the unset state.
The main change here is to move the code that set the UBO content out
of the ColorPassDescriptorSet (and a few other) into View and instead of
updating the content in the color pass (and a few other), do that at
the beginning of Renderer::render().
In the introduction of MaterialInstanceManager, the assumption is
that everytime PostprocessManager wants an instance, we can just
provide a "new" one since all of the instance's content - UBOS,
textures - will not be shared between passes. But this is not
the right assumption. For `colorGradingPrepareSubpass` and
`customResolvePrepareSubpass`, they are filling in an instance
for later passes to use.
To address this, we add a way to identify a fixed instance in
MaterialInstanceManager. This will allow us to refer to specific
instances of a material across passes (for the duration of a
frame).
This address the following crashes:
- Enabling custom resolve for MSAA for the metal backend
- Resizing the gltf_viewer window
Also move the dof instance into the loop to prevent UBO reuse.
Remove instance dependencies in Gaussian Blur Pass (separable).
Filament used to issue command queue flushes (E.g. glFlush()) after
large passes like the color pass in order to kick the gpu into action
sooner and reduce latency. This however comes at a high cost on the
gpu timeline as command queue flushes are expensive on vulkan and
metal. Moreover GL drivers are allowed to ignore glFlush().
So we just remove all these calls.
Previously, cancelling shader compilation tokens in THREAD_POOL mode
would block the engine thread until GL resource loading completed. This
led to unexpected application stalls when numerous shaders were
simultaneously cancelled.
This change moves the token cancellation logic to the compiler thread.
By marking tokens for asynchronous cancellation, we prevent unwanted
main thread stalls, ensuring a smoother user experience during bulk
shader cancellation.
BUGS=[430068776]
We add a class to manage a cache of material instances mapped by
materials. This allows us to re-use instances across frames. Note
hat also it's possible for the same frame to want to use the same
instance multiple times (for example for bilateral blurring or
upsampling), but we allocate separate instances for that case so
that UBOs are not shared across render passes. This allows for
bubble-reduction for vulkan (and possibly other backends).