To allow easy enabling/disabling of debug options like vulkan
validation, android systrace, debug printing, and others, we
introduce an option to add a preprocessor flag so that a
backend can (optionally) use it to manage debug options.
* vk: Fix unsupported depth blitting
On certain hardware (pixel 4 for example), blitting of depth texture
is not supported as an "optimalTilingFeature". In these cases, we'd
would need to do a shader-based blit. We
- Add the shader blit in PostProcessingManager
- Add a driver API to check for support for blitting depthStencil
attachments.
- Fix some debugging ifdefs in vk backend.
The validation fixed is:
`[ VUID-vkCmdBlitImage-dstImage-02000 ] Object 0: handle = 0xb400007c300701d0, type = VK_OBJECT_TYPE_COMMAND_BUFFER; Object 1: handle = 0xf2039b0000000771, type = VK_OBJECT_TYPE_IMAGE; | MessageID = 0x86bc2a78 | In vkCmdBlitImage, VkFormatFeatureFlags (0x1c601) does not support required feature VK_FORMAT_FEATURE_2_BLIT_DST_BIT for format 126 used by VkImage 0xf2039b0000000771[] with tiling VK_IMAGE_TILING_OPTIMAL. The Vulkan spec states: The format features of dstImage must contain VK_FORMAT_FEATURE_BLIT_DST_BIT`
This largely undoes a change I did recently where PrimitiveInfo has
a FRenderPrimitive* to save some space and keep a command at 64 bytes.
This wasn't a good idea because the inner rendering loop shouldn't
to any dereference in the common case.
This change reorganises PrimitiveInfo such that it stores all the data
necessary to render a primitive in the common case. The less common
cases are when hybrid instancing, morphing or skinning are used; in
those cases, a dereference into the renderable SOA is needed.
PrimitiveInfo currently has 16 bytes free, which we keep for futur use.
In opengl it's possible to bind several textures to the same texture
unit as long as they're a different target. Until now we were tracking
that state. In practice it's not very useful to bind several textures
to the same unit (it is a little bit when updating texture data, but
not when rendering). With the coming change to a descriptor set API, it
is better to have a 1-to-1 mapping between bound textures and texture
units.
So with this change, only a single texture can be bound to a texture
unit. If another texture in bound to the same unit with a different
target, we first unbind the texture from the current target.
There is less state to track, and it allows us to
"unbind a texture unit" (whereas before we'd have to iterate through
all the possible targets for that unit and unbind all of them).
* don't rely on FMaterialInstance having a default ctor
FMaterialInstance needed a default ctor because it is a field of
FMaterial but cannot be initialized before FMaterial itself is
initialized. So we had a defautl ctor and we'd finish the initialization
later. Conceptually the default material instance should have been
new'ed and a pointer to it stored instead.
That's basically what we do now, but to avoid the extra allocation,
we in-place new and delete the default material instance into an
aligned_storage inside FMaterial.
* Update filament/src/details/Material.h
Co-authored-by: Ben Doherty <bendoherty@google.com>
---------
Co-authored-by: Ben Doherty <bendoherty@google.com>
the gl backend did some of its cleanup in the its destructor,
including calling into OpenGL, however, the destructor is called from
the main thread, not the GL thread, so these calls would be no-ops at
best, and crashes in the worst case.
* don't crash if we don't have a Camera set on View
- also add a method to query if a camera was set
* Update android/filament-android/src/main/java/com/google/android/filament/View.java
Co-authored-by: Powei Feng <powei@google.com>
---------
Co-authored-by: Powei Feng <powei@google.com>
using thread affinity naively on big.little architectures is very flaky,
for now it's better to simplify and not use it at all, let the kernel
figure things out.
BUGS=[333582569]
* gltfio: add Asset/Resource extended implementations
- Add gltfio/src/extended to implement an alternate loader for
primitives. This is largely based on the implementation in
AssetLoader/ResourceLoader
- Able to correctly produce flat shading from gltf that only have
vertex positions and indices.
- This is not hooked into current code and should have no
practical effect on gltfio.
Originally we did this because we wanted to run on a big core on
android. However setting the thread affinity in this way is fragile,
we are not guaranteed to be on a big core, and we don't even know
if some thread is pinned to that core already; which was the case
with some GL drivers. This can also cause scheduling problems with
other threads.
We just remove this logic entirely for now, and we'll figure out
something better later to run on a big core.
Fixes#7748
BUGS=[333949404]
This change introduces a new chunk type to material files for precompiled Metal libraries. Previously, SPIR-V was the only binary type, so there's also a couple of refactor commits present here. Nothing is changed in Filament or matc yet.
BUGS=[333547148]
- Use new descriptor set and layout caching
- Remove descriptor set related code in VulkanPipelineCache
- fix leaks for descriptor sets/layouts
FIXES=248594812,325157400
A MaterialParser could be leaked if several edits happened before they
were latched -- this was because the MaterialParser was stored as
a raw pointer instead of a unique_ptr<>, this was done as an attempt
to avoid to use a lock around accessing mPendingEdits.
Added
- Cache for layouts
- Pools for descriptor sets
- Cache for descriptor set updates
- Cache for pipeline layouts
Does not have effect on implementation.