Commit Graph

6623 Commits

Author SHA1 Message Date
Benjamin Doherty
7f92dfd06c Release Filament 1.55.1 2024-11-04 09:34:01 -08:00
Powei Feng
3304a0c8b6 vk: add resource ref-counting alternative (#8220)
We add a set of classes to the vk backend that will enable
cleaner ref-counting.

In particular, all allocation from the HandleAllocator will be
wrapped within a resource_ptr<> smart pointer. This struct will
maintain a count that will increment/decrement with respect to
references (similar to std::shared_ptr).

This commit only introduces the new classes/structs and does not
actually make any functional difference. A follow-up commit will
make the switch to use the smart pointer.

We also put VulkanFence and VulkanTimerQuery in a different header
because we will need to depend on them separately in the follow-up
(reason: they are accessed on the backend thread but allocated on
"sync"/filament thread).
2024-11-01 21:36:56 +00:00
Ben Doherty
0c2d23e55c Metal: unbind SwapChain upon destruction (#8244) 2024-11-01 14:16:54 -07:00
mdagois
59d1ed6a94 Trace (#8218)
Add performance tracing for GL/VK on Android
2024-11-01 14:11:32 -07:00
Evan Mezeske
33c299d3ba Ignore another warning for vk_mem_alloc.h so that Filament can compile with -Wthread-safety enabled 2024-10-30 11:57:18 -07:00
Mathias Agopian
1cc87aa9af descriptor layouts distinguish samplers and external samplers
BUGS=[376089915]
2024-10-30 11:17:38 -07:00
Serge Metral
eb1b30c7b1 vk: protected content platform (#8226)
Adding the basic mechanisms for creating and managing the protected
state. We also create the queue and get it. Finally we allocate
protected memory. Also removed some of the shared context logic
2024-10-29 21:32:18 +00:00
Mathias Agopian
ecedbad5ba allow bindDescriptorSet() to take a null handle 2024-10-29 11:10:52 -07:00
Ben Doherty
d1998c1b67 Metal: unbind descriptor set with null handle (#8237) 2024-10-29 10:53:24 -07:00
Powei Feng
c2177ab86a vk: implement descriptor set unbind (#8236) 2024-10-29 17:21:13 +00:00
Mathias Agopian
f4d87ad526 prepare rendering loop for multithreading
The goal of this PR is to get closer to being able to run all
FrameGraph passes in parallel. To achieve this we need all data
consumed by the "execute" closure of the FrameGraph passes to be
immutable or thread-safe. We also need the passes to never use the
Engine's global `DriverAPi&` object.

Specifically in this PR, we turn as many objects to `const` as possible
without major changes, and we pass the `DriverApi&` object as parameter
to render passes.

This work is far from being complete. So we also annotate with FIXMEs
all the places we can identify will be problematic (there are probably
others).

The main remaining issues are:
- main allocator is not thread-safe
- some places take a non-const View, Scene or Engine
- lazy allocation of materials and material instance usages are not
  thread-safe.

This PR shouldn't change any behavior.
2024-10-28 12:31:24 -07:00
Evan Mezeske
f2f9c547b0 Fix clang c++20 compilation under debug mode as well. (#8233)
* Fix clang c++20 compilation under debug mode as well.

* Fix whitespace
2024-10-25 11:10:46 -07:00
Powei Feng
ea1c5d8f24 vk: improve rendertarget initialization (#8228)
Move a lot of the code from beginRenderPass() to the initialization
of the RenderTarget. This will save us a bit of CPU when
RenderTarget is re-used.

We also reduce the size of the VulkanRenderTarget handle and put
must of the caching bits into a heap struct.
2024-10-25 17:36:30 +00:00
Mathias Agopian
42d39834df update remote ui 2024-10-25 00:30:10 -07:00
Mathias Agopian
7ea7fa18eb update beamsplitter template
the generated file was modified, which would be undo'ed next time
we run beamsplitter
2024-10-25 00:29:13 -07:00
Mathias Agopian
a6b4c9fae1 fix gltf_viewer android sample build 2024-10-25 00:14:08 -07:00
Evan Mezeske
8d02cd0383 Fix bug in ResourceAllocator with erasing iterators inside loops (#8223) 2024-10-24 13:56:41 -07:00
Bob Conan
016882336a Update RELEASE_NOTES.md, fix a typo (#8227) 2024-10-24 13:56:05 -07:00
Ben Doherty
3f150e03bf Check that SwapChain is valid in endFrame (#8219) 2024-10-24 12:33:11 -07:00
Romain Guy
99308c98ba Update Android dependencies (#8224) 2024-10-23 15:49:01 -07:00
Evan Mezeske
6eee4520c7 vk: Add a workaround for a Windows NVIDIA Vulkan driver bug that causes swap chains to be created with incorrect dimensions for native windows created with thread-specific DPI-awareness context. (#8221) 2024-10-22 22:01:58 -07:00
Sungun Park
fa3a5d9eb4 Use xvp for multiview + debug view (#8222)
When multiview is enabled with the combining debug option toggled on, we
use an intermediate buffer that requires us to use the entire area of
the buffer as the viewport. Use xvp in this case.
2024-10-22 21:21:53 +00:00
show50726
17e4d2b92e Add public API in View for transparent picking (#8206) 2024-10-22 10:46:24 -07:00
kunyoung.park
13310e4ba0 Fix issue where material instance name cannot be set without creating a default instance (#8213) 2024-10-22 10:45:32 -07:00
Ben Doherty
eab8490d14 Metal: add better logging for invalid index element size (#8194) 2024-10-22 11:08:51 -04:00
Evan Mezeske
edece8f3dc Fix a bug in the OpenGL backend that causes win32 errors not to be logged #8214 (#8216)
* Capture the last win32 error immediately after failing win32 API functions are called in order to log it correctly. Prior to this change, intervening win32 API calls could clear the error code and it would not be logged.

* Oops fix bad whitespace in previous commit
2024-10-21 16:35:54 -07:00
Sungun Park
2456299337 Add a warning for FRenderableManager (#8210)
In some cases, users set materials first without providing render primitives, which has incurred the attribute mismatching warning. This isn't helpful because users don't know what action they should take to remove the warning.

Emit the warning only when the primitive handle is initialized so the AttributeBitset is properly populated.

BUGS=[372755205]
2024-10-20 15:08:13 +00:00
Ben Doherty
6e9afff7ba Fix potential crash when a descriptor set is destroyed but not unbound (#8215) 2024-10-18 16:42:14 -04:00
Mathias Agopian
4425338559 avoid setting the scissor rect when possible
RenderPass is now tracking the scissor state locally so it can avoid
re-setting the scissor when it doesn't change.

We also consolidate the scissor override and the scissor-viewport in
RenderPass::Execute.
2024-10-18 10:05:02 -07:00
Ben Doherty
a494f9ff6a Metal: avoid redundant scissor rect state changes (#8207) 2024-10-18 11:07:11 -04:00
Mathias Agopian
ba680cf11a Revert "avoid setting the scissor rect when possible"
This reverts commit fc095413b3.

clipping is wrong when post-processing is disabled
2024-10-17 16:00:48 -07:00
Mathias Agopian
fc095413b3 avoid setting the scissor rect when possible
RenderPass is now tracking the scissor state locally so it can avoid
re-setting the scissor when it doesn't change.

We also consolidate the scissor override and the scissor-viewport in
RenderPass::Execute.
2024-10-17 14:16:36 -07:00
Mathias Agopian
d80526528c Cleanup PostPorcessManager rendering
- the main goal of this change was to move some state changes outside
  of loops, usually with mip generation.

- for instance bindPostProcessDesciptorSet() must now be issued
  manually (and can be done outside the loop)

- we also don't set the scissor for each pass

- we also move prepareMaterial() outside of getPipelineState(), it's
  now done in PostProcessMaterial::getMaterial().

- We use PostProcessVariant instead of uint8_t everywhere

In the end we have three drawing helpers:

- commitAndRenderFullScreenQuad() which updates a material instance,
  binds the corresponding material and draws a full screen quad.
- renderFullScreenQuad() which just renders a full screen quad.
- renderFullScreenQuadWithScissor() which does the same but scisorred

Additionally, we have the following helpers for getting materials and
instances:

- PostProcessMaterial::getMaterial(): which returns the FMaterial
- PostProcessMaterial::getMaterialInstance(): which is now a helper
  returning a material instance from a PostProcessMaterial or FMaterial

Most of the change is pluming through these API changes.
2024-10-17 14:16:05 -07:00
Guilhem Saurel
38e59fbd6b add missing includes 2024-10-17 14:15:40 -07:00
show50726
a5e6df1ad3 Address the comments 2024-10-17 10:19:02 -07:00
show50726
23d1329f37 Disable transparent pickable by default 2024-10-17 10:19:02 -07:00
show50726
25b37d36ad First push
Fix the texture format

Decide texture format based on feature level
2024-10-17 10:19:02 -07:00
Mathias Agopian
68265ae793 no need to copy the PostProcessMaterial mConstants field
It always references static data. Additionally, we don't need
to use a vector to store the specialization constants, because
it's also all static data.

And finally, we don't need a boolean to know the state of the
PostProcessMaterial, the mSize field can encode the same
information.
2024-10-16 17:25:38 -07:00
Ben Doherty
e8f3fc5a46 Implement setThreadPriority for Apple devices (#8200) 2024-10-16 12:55:25 -04:00
Evan Mezeske
22db1be939 Add support for compiling under c++20 on clang-based compilers. The warnings that this change ignores are tricky to fix in the code in a way that is backwards compatible with c++17, but it is possible to do and it would allow these warnings to be reinstated. (#8199) 2024-10-15 16:45:32 -04:00
Powei Feng
a3290d7656 vk: remove history from DescriptorSetManager (#8193)
"history" is a map from a DescriptorSet pointer to a set of
bookkeeping values (we delay "binding" until "commit" so need to
keep values until then). Instead of using a map, we can store
these values in the DescriptorSet itself so that we save on a
map look-up.
2024-10-14 19:46:27 +00:00
Powei Feng
4ee33cd591 Release Filament 1.55.0 2024-10-14 06:07:34 +00:00
Evan Mezeske
fd2f9555f1 Fix tiny typo in VulkanPlatformSwapChainImpl.cpp logging (#8196) 2024-10-11 23:09:32 +00:00
Mathias Agopian
ccdb58e93c don't set ANGLE features in filament (#8192)
ANGLE features should be set by apps, the system or developers but it's
not a good idea to set them in a library as it might conflict with other
libs etc.

we did it because it improved performance, but that should be fixed at
the angle level instead.
2024-10-11 13:52:54 -07:00
Ben Doherty
1eb1df2cf2 Check for use-after-free for heap handles (#8182) 2024-10-11 20:28:18 +00:00
Mathias Agopian
d784ce311f gles: add a flag to enable the validation of the nativewindow
We are seeing a cluster of crashes that could be due to using an
EGLSurface whose ANativeWindow has become invalid. This could happen if
we continued to use (i.e. draw with) an EGLSurface after 
SurfaceHolder::onSurfaceDestroyed() has returned.

This new flag enables an assertion that the native window is valid at
the time of makeCurrent(), which happens early in the frame.

BUG=[330392256]
2024-10-10 13:38:35 -07:00
Powei Feng
875b295967 vk: refactor texture default layout (#8183)
Previously, default layout is based on usage, but this actually
has two paths (Filament's TextureUsage and the computed
VkTextureUsage) that do not always agree.  We simplify so that
default layout is stored in the texture itself.

Also remove some unnecessary code that is no longer necessary.
In particular, we shouldn't be doing a flush and wait for the
transition to complete before updating a sampler descriptor.
We just need to make sure the layout before it is accessed is
correctly given in the update struct.
2024-10-10 19:31:20 +00:00
Powei Feng
b1b2d7072d Revert "Release Filament 1.55.0" (#8191)
This reverts commit 4f5369cefa.

Reason: Initial attempt to release 1.55.0 failed due to a few
   small bugs.
2024-10-10 12:16:00 -07:00
Sungun Park
014e6bcbde Update hardware Handle (#8187)
In certain compilers, the assignment operators defined as default
doesn't automatically make a call to the parent's method if it's
user-defined.

Make this behavior explicit to avoid this edge case.

BUGS=[371980551]
2024-10-10 17:12:22 +00:00
Powei Feng
614dbb44d5 Make sure color attachment textures have copy-able usage set (#8184)
To ensure the source of readPixels() is properly copy-able, we
want the backing textures to be created with the right BLIT_SRC usage.
However, this was not documented in the API. We workaround the issue
to tag all color attachment textures as BLIT_SRC.

This workaround will be removed in the future. For now, violations of
this condition will elicit a warning being printed out.
2024-10-10 16:02:11 +00:00