- 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